deployCluster.sh 1.6 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 10 11 12 13 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
masterDnode=slave
dataRootDir="/data"
firstEp="trd02:7000"
startPort=7000
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 已提交
51
# deployCluster.sh 
P
plum-lihui 已提交
52 53
curr_dir=$(readlink -f "$(dirname "$0")")
echo $curr_dir
P
plum-lihui 已提交
54

P
plum-lihui 已提交
55 56
${curr_dir}/cleanCluster.sh -r "/data"
${curr_dir}/cleanCluster.sh -r "/data2"
P
plum-lihui 已提交
57

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

P
plum-lihui 已提交
62 63
${curr_dir}/setupDnodes.sh -r "/data"  -n ${dnodeNumber} -f ${firstEp} -p 7000
${curr_dir}/setupDnodes.sh -r "/data2" -n ${dnodeNumber} -f ${firstEp} -p 8000
P
plum-lihui 已提交
64

P
plum-lihui 已提交
65 66 67 68 69 70 71 72
if [[ "${masterDnode}" == "master" ]]; then
  # create all dnode into cluster
  taos -s "create dnode trd02 port 8000;"
  taos -s "create dnode trd03 port 7000;"
  taos -s "create dnode trd03 port 8000;"
  taos -s "create dnode trd04 port 7000;"
  taos -s "create dnode trd04 port 8000;"
fi
P
plum-lihui 已提交
73 74 75 76