deploy.sh 3.2 KB
Newer Older
S
slguan 已提交
1 2 3 4
#!/bin/sh

echo "Executing deploy.sh"

S
slguan 已提交
5
if [ $# != 4 ]; then 
S
slguan 已提交
6 7
  echo "argument list need input : "
  echo "  -n nodeName"
S
slguan 已提交
8
  echo "  -i nodePort"
S
slguan 已提交
9 10 11 12
  exit 1
fi

NODE_NAME=
S
slguan 已提交
13 14
NODE=
while getopts "n:i:" arg 
S
slguan 已提交
15 16 17 18 19 20
do
  case $arg in
    n)
      NODE_NAME=$OPTARG
      ;;
    i)
S
slguan 已提交
21
      NODE=$OPTARG
S
slguan 已提交
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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
      ;;
    ?)
      echo "unkonw argument"
      ;;
  esac
done

SCRIPT_DIR=`dirname $0`
cd $SCRIPT_DIR/../
SCRIPT_DIR=`pwd`
echo "SCRIPT_DIR: $SCRIPT_DIR" 

cd ../../
TAOS_DIR=`pwd`

BUILD_DIR=$TAOS_DIR/debug/build
SIM_DIR=$TAOS_DIR/sim

NODE_DIR=$SIM_DIR/$NODE_NAME
EXE_DIR=$BUILD_DIR/bin
CFG_DIR=$NODE_DIR/cfg
LOG_DIR=$NODE_DIR/log
DATA_DIR=$NODE_DIR/data

rm -rf $NODE_DIR

mkdir -p $SIM_DIR
mkdir -p $NODE_DIR
mkdir -p $LOG_DIR
mkdir -p $DATA_DIR

#cp -rf $TAOS_DIR/cfg  $NODE_DIR/
mkdir -p $CFG_DIR

#allow normal user to read/write log
chmod -R 777 $NODE_DIR

TAOS_CFG=$NODE_DIR/cfg/taos.cfg
touch -f $TAOS_CFG

TAOS_FLAG=$SIM_DIR/tsim/flag
if [ -f "$TAOS_FLAG" ] ; then 
  TAOS_CFG=/etc/taos/taos.cfg
  DATA_DIR=/var/lib/taos
  LOG_DIR=/var/log/taos
  sudo rm -f /etc/taos/*.cfg
  sudo cp -rf $TAOS_DIR/cfg/*.cfg /etc/taos
  sudo rm -rf $DATA_DIR
  sudo rm -rf $LOG_DIR
fi

73
HOSTNAME=`hostname -f`
S
slguan 已提交
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96

if [ $NODE -eq 1 ]; then
  NODE=7100
elif [ $NODE -eq 2 ]; then
  NODE=7200
elif [ $NODE -eq 3 ]; then
  NODE=7300
elif [ $NODE -eq 4 ]; then
  NODE=7400
elif [ $NODE -eq 5 ]; then
  NODE=7500
elif [ $NODE -eq 6 ]; then
  NODE=7600  
elif [ $NODE -eq 7 ]; then
  NODE=7700  
elif [ $NODE -eq 8 ]; then
  NODE=7800    
fi

echo " "                                    >> $TAOS_CFG   
echo "first               ${HOSTNAME}:7100" >> $TAOS_CFG
echo "second              ${HOSTNAME}:7200" >> $TAOS_CFG
echo "serverPort          ${NODE}"          >> $TAOS_CFG
S
slguan 已提交
97 98
echo "dataDir             $DATA_DIR"      >> $TAOS_CFG
echo "logDir              $LOG_DIR"       >> $TAOS_CFG
S
scrpits  
Shengliang Guan 已提交
99 100 101 102
echo "dDebugFlag          135"            >> $TAOS_CFG
echo "mDebugFlag          135"            >> $TAOS_CFG
echo "sdbDebugFlag        135"            >> $TAOS_CFG
echo "rpcDebugFlag        135"            >> $TAOS_CFG
S
slguan 已提交
103 104
echo "tmrDebugFlag        131"            >> $TAOS_CFG
echo "cDebugFlag          135"            >> $TAOS_CFG
105
echo "httpDebugFlag       135"            >> $TAOS_CFG
S
slguan 已提交
106 107 108
echo "monitorDebugFlag    131"            >> $TAOS_CFG
echo "udebugFlag          131"            >> $TAOS_CFG
echo "jnidebugFlag        131"            >> $TAOS_CFG
S
scripts  
slguan 已提交
109
echo "sdebugFlag          135"            >> $TAOS_CFG
S
slguan 已提交
110
echo "monitor             0"              >> $TAOS_CFG
guanshengliang's avatar
guanshengliang 已提交
111
echo "monitorInterval     1"              >> $TAOS_CFG
S
slguan 已提交
112
echo "http                0"              >> $TAOS_CFG
S
slguan 已提交
113 114 115 116
echo "numOfThreadsPerCore 2.0"            >> $TAOS_CFG
echo "defaultPass         taosdata"       >> $TAOS_CFG
echo "numOfLogLines       100000000"      >> $TAOS_CFG
echo "mgmtEqualVnodeNum   0"              >> $TAOS_CFG
S
slguan 已提交
117
echo "clog                2"              >> $TAOS_CFG
S
slguan 已提交
118 119 120 121 122 123 124 125
echo "statusInterval      1"              >> $TAOS_CFG
echo "numOfTotalVnodes    4"              >> $TAOS_CFG
echo "asyncLog            0"              >> $TAOS_CFG
echo "numOfMPeers         1"              >> $TAOS_CFG
echo "locale    en_US.UTF-8"              >> $TAOS_CFG
echo "anyIp               0"              >> $TAOS_CFG