提交 8c8f3d08 编写于 作者: L liuyq-617

[TD-3406]<test>support more dnodes in docker clu

上级 d546f74a
...@@ -45,8 +45,8 @@ class BuildDockerCluser: ...@@ -45,8 +45,8 @@ class BuildDockerCluser:
os.system("docker exec -d $(docker ps|grep tdnode1|awk '{print $1}') tarbitrator") os.system("docker exec -d $(docker ps|grep tdnode1|awk '{print $1}') tarbitrator")
def run(self): def run(self):
if self.numOfNodes < 2 or self.numOfNodes > 5: if self.numOfNodes < 2 or self.numOfNodes > 10:
print("the number of nodes must be between 2 and 5") print("the number of nodes must be between 2 and 10")
exit(0) exit(0)
print("remove Flag value %s" % self.removeFlag) print("remove Flag value %s" % self.removeFlag)
if self.removeFlag == False: if self.removeFlag == False:
......
...@@ -32,7 +32,7 @@ do ...@@ -32,7 +32,7 @@ do
done done
function addTaoscfg { function addTaoscfg {
for i in {1..5} for((i=1;i<=$NUM_OF_NODES;i++))
do do
touch $DOCKER_DIR/node$i/cfg/taos.cfg touch $DOCKER_DIR/node$i/cfg/taos.cfg
echo 'firstEp tdnode1:6030' > $DOCKER_DIR/node$i/cfg/taos.cfg echo 'firstEp tdnode1:6030' > $DOCKER_DIR/node$i/cfg/taos.cfg
...@@ -42,7 +42,7 @@ function addTaoscfg { ...@@ -42,7 +42,7 @@ function addTaoscfg {
} }
function createDIR { function createDIR {
for i in {1..5} for((i=1;i<=$NUM_OF_NODES;i++))
do do
mkdir -p $DOCKER_DIR/node$i/data mkdir -p $DOCKER_DIR/node$i/data
mkdir -p $DOCKER_DIR/node$i/log mkdir -p $DOCKER_DIR/node$i/log
...@@ -53,7 +53,7 @@ function createDIR { ...@@ -53,7 +53,7 @@ function createDIR {
function cleanEnv { function cleanEnv {
echo "Clean up docker environment" echo "Clean up docker environment"
for i in {1..5} for((i=1;i<=$NUM_OF_NODES;i++))
do do
rm -rf $DOCKER_DIR/node$i/data/* rm -rf $DOCKER_DIR/node$i/data/*
rm -rf $DOCKER_DIR/node$i/log/* rm -rf $DOCKER_DIR/node$i/log/*
...@@ -99,22 +99,44 @@ function clusterUp { ...@@ -99,22 +99,44 @@ function clusterUp {
cd $DOCKER_DIR cd $DOCKER_DIR
if [ $NUM_OF_NODES -eq 2 ]; then # if [ $NUM_OF_NODES -eq 2 ]; then
echo "create 2 dnodes" # echo "create 2 dnodes"
PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz TARBITRATORPKG=TDengine-arbitrator-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION DATADIR=$DOCKER_DIR docker-compose up -d # PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz TARBITRATORPKG=TDengine-arbitrator-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION DATADIR=$DOCKER_DIR docker-compose up -d
fi # fi
docker_run="PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz TARBITRATORPKG=TDengine-arbitrator-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION DATADIR=$DOCKER_DIR docker-compose -f docker-compose.yml "
if [ $NUM_OF_NODES -eq 3 ]; then if [ $NUM_OF_NODES -ge 2 ];then
PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz TARBITRATORPKG=TDengine-arbitrator-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION DATADIR=$DOCKER_DIR docker-compose -f docker-compose.yml -f node3.yml up -d echo "create $NUM_OF_NODES dnodes"
fi for((i=3;i<=$NUM_OF_NODES;i++))
do
if [ $NUM_OF_NODES -eq 4 ]; then if [ ! -f node$i.yml ];then
PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz TARBITRATORPKG=TDengine-arbitrator-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION DATADIR=$DOCKER_DIR docker-compose -f docker-compose.yml -f node3.yml -f node4.yml up -d echo "node$i.yml not exist"
# cp $CURR_DIR/node3.yml $CURR_DIR/node$i.yml
# sed -i "s/td2.0-node3/td2.0-node$i/g" $CURR_DIR/node$i.yml
# sed -i "s/'tdnode3'/'tdnode$i'/g" $CURR_DIR/node$i.yml
# sed -i "s#/node3/#/node$i/#g" $CURR_DIR/node$i.yml
# sed -i "s#ipv4_address: 172.27.0.9#ipv4_address: 172.27.0.`expr $i + 6`#g" $CURR_DIR/node$i.yml
cp node3.yml node$i.yml
sed -i "s/td2.0-node3/td2.0-node$i/g" node$i.yml
sed -i "s/'tdnode3'/'tdnode$i'/g" node$i.yml
sed -i "s#/node3/#/node$i/#g" node$i.yml
sed -i "s#ipv4_address: 172.27.0.9#ipv4_address: 172.27.0.`expr $i + 6`#g" node$i.yml
fi fi
docker_run=$docker_run" -f node$i.yml "
if [ $NUM_OF_NODES -eq 5 ]; then done
PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz TARBITRATORPKG=TDengine-arbitrator-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION DATADIR=$DOCKER_DIR docker-compose -f docker-compose.yml -f node3.yml -f node4.yml -f node5.yml up -d docker_run=$docker_run" up -d"
fi fi
echo $docker_run |sh
# if [ $NUM_OF_NODES -eq 3 ]; then
# PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz TARBITRATORPKG=TDengine-arbitrator-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION DATADIR=$DOCKER_DIR docker-compose -f docker-compose.yml -f node3.yml up -d
# fi
# if [ $NUM_OF_NODES -eq 4 ]; then
# PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz TARBITRATORPKG=TDengine-arbitrator-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION DATADIR=$DOCKER_DIR docker-compose -f docker-compose.yml -f node3.yml -f node4.yml up -d
# fi
# if [ $NUM_OF_NODES -eq 5 ]; then
# PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz TARBITRATORPKG=TDengine-arbitrator-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION DIR2=TDengine-arbitrator-$VERSION VERSION=$VERSION DATADIR=$DOCKER_DIR docker-compose -f docker-compose.yml -f node3.yml -f node4.yml -f node5.yml up -d
# fi
echo "docker compose finish" echo "docker compose finish"
} }
......
...@@ -28,7 +28,7 @@ function removeDockerContainers { ...@@ -28,7 +28,7 @@ function removeDockerContainers {
function cleanEnv { function cleanEnv {
echo "Clean up docker environment" echo "Clean up docker environment"
for i in {1..5} for i in {1..10}
do do
rm -rf $DOCKER_DIR/node$i/data/* rm -rf $DOCKER_DIR/node$i/data/*
rm -rf $DOCKER_DIR/node$i/log/* rm -rf $DOCKER_DIR/node$i/log/*
......
...@@ -30,6 +30,11 @@ services: ...@@ -30,6 +30,11 @@ services:
- "tdnode3:172.27.0.9" - "tdnode3:172.27.0.9"
- "tdnode4:172.27.0.10" - "tdnode4:172.27.0.10"
- "tdnode5:172.27.0.11" - "tdnode5:172.27.0.11"
- "tdnode6:172.27.0.12"
- "tdnode7:172.27.0.13"
- "tdnode8:172.27.0.14"
- "tdnode9:172.27.0.15"
- "tdnode9:172.27.0.16"
volumes: volumes:
# bind data directory # bind data directory
- type: bind - type: bind
......
...@@ -24,10 +24,15 @@ services: ...@@ -24,10 +24,15 @@ services:
sysctl -p && sysctl -p &&
exec my-main-application" exec my-main-application"
extra_hosts: extra_hosts:
- "tdnode1:172.27.0.7"
- "tdnode2:172.27.0.8" - "tdnode2:172.27.0.8"
- "tdnode3:172.27.0.9"
- "tdnode4:172.27.0.10" - "tdnode4:172.27.0.10"
- "tdnode5:172.27.0.11" - "tdnode5:172.27.0.11"
- "tdnode6:172.27.0.12"
- "tdnode7:172.27.0.13"
- "tdnode8:172.27.0.14"
- "tdnode9:172.27.0.15"
- "tdnode9:172.27.0.16"
volumes: volumes:
# bind data directory # bind data directory
- type: bind - type: bind
......
...@@ -28,6 +28,11 @@ services: ...@@ -28,6 +28,11 @@ services:
- "tdnode3:172.27.0.9" - "tdnode3:172.27.0.9"
- "tdnode4:172.27.0.10" - "tdnode4:172.27.0.10"
- "tdnode5:172.27.0.11" - "tdnode5:172.27.0.11"
- "tdnode6:172.27.0.12"
- "tdnode7:172.27.0.13"
- "tdnode8:172.27.0.14"
- "tdnode9:172.27.0.15"
- "tdnode9:172.27.0.16"
volumes: volumes:
# bind data directory # bind data directory
- type: bind - type: bind
......
...@@ -28,6 +28,11 @@ services: ...@@ -28,6 +28,11 @@ services:
- "tdnode3:172.27.0.9" - "tdnode3:172.27.0.9"
- "tdnode4:172.27.0.10" - "tdnode4:172.27.0.10"
- "tdnode5:172.27.0.11" - "tdnode5:172.27.0.11"
- "tdnode6:172.27.0.12"
- "tdnode7:172.27.0.13"
- "tdnode8:172.27.0.14"
- "tdnode9:172.27.0.15"
- "tdnode9:172.27.0.16"
volumes: volumes:
# bind data directory # bind data directory
- type: bind - type: bind
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册