提交 c4e0e94f 编写于 作者: P plum-lihui

[add create table scriptes]

上级 7c77464d
#!/bin/bash
#
# clean test environment
set -e
#set -x
# cleanCluster.sh
# -r [ dnode root dir]
dataRootDir="/data"
while getopts "hr:" arg
do
case $arg in
r)
dataRootDir=$(echo $OPTARG)
;;
h)
echo "Usage: `basename $0` -r [ dnode root dir] "
exit 0
;;
?) #unknow option
echo "unkonw argument"
exit 1
;;
esac
done
rmDnodesDataDir() {
if [ -d ${dataRootDir} ]; then
rm -rf ${dataRootDir}/dnode*
else
echo "${dataRootDir} not exist"
exit 1
fi
}
function kill_process() {
pid=$(ps -ef | grep "$1" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
kill -9 $pid || :
fi
}
########################################################################################
############################### main process ##########################################
## kill all taosd process
kill_process taosd
rmDnodesDataDir
#!/bin/bash
#
# compile test version
set -e
#set -x
# compileVersion.sh
# -r [ TDengine project dir]
# -v [ TDengine branch version ]
projectDir=/root/TDengine
TDengineBrVer="3.0"
while getopts "hr:v:" arg
do
case $arg in
r)
projectDir=$(echo $OPTARG)
;;
v)
TDengineBrVer=$(echo $OPTARG)
;;
h)
echo "Usage: `basename $0` -r [ TDengine project dir] "
echo " -v [ TDengine branch version] "
exit 0
;;
?) #unknow option
echo "unkonw argument"
exit 1
;;
esac
done
echo "projectDir=${projectDir} TDengineBrVer=${TDengineBrVer}"
function gitPullBranchInfo () {
branch_name=$1
git checkout $branch_name
echo "==== git pull $branch_name start ===="
## git submodule update --init --recursive
git pull origin $branch_name ||:
echo "==== git pull $branch_name end ===="
}
function compileTDengineVersion() {
debugDir=debug
if [ -d ${debugDir} ]; then
rm -rf ${debugDir}/* ||:
else
mkdir -p ${debugDir}
fi
cd ${debugDir}
cmake ..
make -j24
}
########################################################################################
############################### main process ##########################################
## checkout all branchs and git pull
cd ${projectDir}
gitPullBranchInfo $TDengineBrVer
compileTDengineVersion
taos_dir=${projectDir}/debug/tools/shell
taosd_dir=${projectDir}/debug/source/dnode/mgmt/daemon
create_table_dir=${projectDir}/debug/tests/test/c
rm -f /usr/bin/taos
rm -f /usr/bin/taosd
rm -f /usr/bin/create_table
ln -s $taos_dir/taos /usr/bin/taos
ln -s $taosd_dir/taosd /usr/bin/taosd
ln -s $create_table_dir/create_table /usr/bin/create_table
#!/bin/bash
#
# deploy test cluster
set -e
#set -x
# deployCluster.sh
curr_dir=$(pwd)
source ./cleanCluster.sh -r /data
source ./cleanCluster.sh -r /data2
source ./compileVersion.sh -r ${curr_dir}/../../../../ -v "3.0"
source ./setupDnodes.sh -r /data -n 1 -f trd02:7000 -p 7000
source ./setupDnodes.sh -r /data2 -n 1 -f trd02:7000 -p 8000
#source ./setupDnodes.sh -r /data -n 2 -f trd02:7000 -p 7000
#source ./setupDnodes.sh -r /data2 -n 2 -f trd02:7000 -p 8000
#!/bin/bash
#
# setup test environment
set -e
#set -x
# setupDnodes.sh
# -e [ new | old]
# -n [ dnode number]
# -f [ first ep]
# -p [ start port]
# -r [ dnode root dir]
# set parameters by default value
enviMode=new
dataRootDir="/data"
firstEp="localhost:7000"
startPort=7000
dnodeNumber=1
while getopts "he:f:n:r:p:" arg
do
case $arg in
e)
enviMode=$( echo $OPTARG )
;;
n)
dnodeNumber=$(echo $OPTARG)
;;
f)
firstEp=$(echo $OPTARG)
;;
p)
startPort=$(echo $OPTARG)
;;
r)
dataRootDir=$(echo $OPTARG)
;;
h)
echo "Usage: `basename $0` -e [new | old] "
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
echo "enviMode=${enviMode} dnodeNumber=${dnodeNumber} dataRootDir=${dataRootDir} firstEp=${firstEp} startPort=${startPort}"
#curr_dir=$(pwd)
createNewCfgFile() {
cfgFile=$1/taos.cfg
dataDir=$2
logDir=$3
firstEp=$4
serverPort=$5
echo "debugFlag 131" > ${cfgFile}
echo "firstEp ${firstEp}" >> ${cfgFile}
echo "dataDir ${dataDir}" >> ${cfgFile}
echo "logDir ${logDir}" >> ${cfgFile}
echo "serverPort ${serverPort}" >> ${cfgFile}
echo "supportVnodes 1024" >> ${cfgFile}
#echo "asyncLog 0" >> ${cfgFile}
echo "telemetryReporting 0" >> ${cfgFile}
}
createNewDnodesDataDir() {
if [ -d ${dataRootDir} ]; then
rm -rf ${dataRootDir}/dnode*
else
echo "${dataRootDir} not exist"
exit 1
fi
dnodeNumber=$1
firstEp=$2
serverPort=${startPort}
for ((i=0; i<${dnodeNumber}; i++)); do
mkdir -p ${dataRootDir}/dnode_${i}/cfg
mkdir -p ${dataRootDir}/dnode_${i}/log
mkdir -p ${dataRootDir}/dnode_${i}/data
createNewCfgFile ${dataRootDir}/dnode_${i}/cfg ${dataRootDir}/dnode_${i}/data ${dataRootDir}/dnode_${i}/log ${firstEp} ${serverPort}
echo "create dnode: ${serverPort}, ${dataRootDir}/dnode_${i}"
serverPort=$((10#${serverPort}+100))
done
}
function kill_process() {
pid=$(ps -ef | grep "$1" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
kill -9 $pid || :
fi
}
startDnodes() {
dnodeNumber=$1
for ((i=0; i<${dnodeNumber}; i++)); do
if [ -d ${dataRootDir}/dnode_${i} ]; then
nohup taosd -c ${dataRootDir}/dnode_${i}/cfg >/dev/null 2>&1 &
echo "start taosd ${dataRootDir}/dnode_${i}"
fi
done
}
########################################################################################
############################### main process ##########################################
## kill all taosd process
kill_process taosd
## create director for all dnode
if [[ "$enviMode" == "new" ]]; then
createNewDnodesDataDir ${dnodeNumber} ${firstEp}
fi
## start all dnode by nohup
startDnodes ${dnodeNumber}
echo " run setupDnodes.sh end !!!"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册