deployCluster.sh 1.3 KB
Newer Older
P
plum-lihui 已提交
1 2 3 4 5 6 7
#!/bin/bash
#
# deploy test cluster

set -e
#set -x

P
plum-lihui 已提交
8 9
fqdn=`hostname`

P
plum-lihui 已提交
10 11
masterDnode=slave
dataRootDir="/data"
P
plum-lihui 已提交
12 13
firstEp="${fqdn}:6030"
startPort=6030
P
plum-lihui 已提交
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
dnodeNumber=1
updateSrc=no

while getopts "hm:f:n:r:p:u:" arg
do
  case $arg in
    m)
      masterDnode=$( echo $OPTARG )
      ;;
    n)
      dnodeNumber=$(echo $OPTARG)
      ;;
    u)
      updateSrc=$(echo $OPTARG)
      ;;
    f)
      firstEp=$(echo $OPTARG)
      ;;
    p)
      startPort=$(echo $OPTARG)
      ;;
    r)
      dataRootDir=$(echo $OPTARG)
      ;;
    h)
      echo "Usage: `basename $0` -m [if master dnode] "
      echo "                  -n [ dnode number] "
      echo "                  -f [ first ep] "
      echo "                  -p [ start port] "
      echo "                  -r [ dnode root dir] "
      exit 0
      ;;
    ?) #unknow option
      echo "unkonw argument"
      exit 1
      ;;
  esac
done

P
plum-lihui 已提交
53
# deployCluster.sh 
P
plum-lihui 已提交
54 55
curr_dir=$(readlink -f "$(dirname "$0")")
echo $curr_dir
P
plum-lihui 已提交
56

P
plum-lihui 已提交
57
${curr_dir}/cleanCluster.sh -r ${dataRootDir}
P
plum-lihui 已提交
58

P
plum-lihui 已提交
59 60 61
if [[ "${updateSrc}" == "yes" ]]; then
  ${curr_dir}/compileVersion.sh -r ${curr_dir}/../../../../ -v "3.0"
fi
P
plum-lihui 已提交
62

P
plum-lihui 已提交
63
${curr_dir}/setupDnodes.sh -r ${dataRootDir}  -n ${dnodeNumber} -f ${firstEp} -p ${startPort}
P
plum-lihui 已提交
64

P
plum-lihui 已提交
65
if [[ "${masterDnode}" == "master" ]]; then
P
plum-lihui 已提交
66 67
  taos -s "create dnode trd03 port 6030;"
  taos -s "create dnode trd04 port 6030;"
P
plum-lihui 已提交
68
fi
P
plum-lihui 已提交
69 70 71 72