提交 3626a2de 编写于 作者: P Ping Xiao

update docker cluster script

上级 8e9282ba
...@@ -12,9 +12,6 @@ ...@@ -12,9 +12,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from basic import * from basic import *
from util.sql import tdSql
class TDTestCase: class TDTestCase:
...@@ -36,4 +33,6 @@ td = TDTestCase() ...@@ -36,4 +33,6 @@ td = TDTestCase()
td.init() td.init()
## usage: python3 OneMnodeMultipleVnodesTest.py
...@@ -44,7 +44,16 @@ class BuildDockerCluser: ...@@ -44,7 +44,16 @@ class BuildDockerCluser:
"jnidebugFlag":"135", "jnidebugFlag":"135",
"qdebugFlag":"135", "qdebugFlag":"135",
"maxSQLLength":"1048576" "maxSQLLength":"1048576"
} }
cmd = "mkdir -p %s" % self.dockerDir
self.execCmd(cmd)
cmd = "cp *.yml %s" % self.dockerDir
self.execCmd(cmd)
cmd = "cp Dockerfile %s" % self.dockerDir
self.execCmd(cmd)
# execute command, and return the output # execute command, and return the output
# ref: https://blog.csdn.net/wowocpp/article/details/80775650 # ref: https://blog.csdn.net/wowocpp/article/details/80775650
...@@ -81,7 +90,7 @@ class BuildDockerCluser: ...@@ -81,7 +90,7 @@ class BuildDockerCluser:
def removeFile(self, rootDir, index, dir): def removeFile(self, rootDir, index, dir):
cmd = "rm -rf %s/node%d/%s/*" % (rootDir, index, dir) cmd = "rm -rf %s/node%d/%s/*" % (rootDir, index, dir)
self.execCmd(cmd) self.execCmd(cmd)
def clearEnv(self): def clearEnv(self):
cmd = "cd %s && docker-compose down --remove-orphans" % self.dockerDir cmd = "cd %s && docker-compose down --remove-orphans" % self.dockerDir
self.execCmd(cmd) self.execCmd(cmd)
...@@ -108,10 +117,14 @@ class BuildDockerCluser: ...@@ -108,10 +117,14 @@ class BuildDockerCluser:
self.execCmd(cmd) self.execCmd(cmd)
def updateLocalhosts(self): def updateLocalhosts(self):
cmd = "grep '172.27.0.7 *tdnode1' /etc/hosts" cmd = "grep '172.27.0.7 *tdnode1' /etc/hosts | sed 's: ::g'"
result = self.execCmdAndGetOutput(cmd) result = self.execCmdAndGetOutput(cmd)
if result and not result.isspace(): print(result)
if result is None or result.isspace():
print("==========")
cmd = "echo '172.27.0.7 tdnode1' >> /etc/hosts" cmd = "echo '172.27.0.7 tdnode1' >> /etc/hosts"
display = "echo %s" % cmd
self.execCmd(display)
self.execCmd(cmd) self.execCmd(cmd)
def deploy(self): def deploy(self):
...@@ -138,13 +151,13 @@ class BuildDockerCluser: ...@@ -138,13 +151,13 @@ class BuildDockerCluser:
if self.numOfNodes < 2 or self.numOfNodes > 10: if self.numOfNodes < 2 or self.numOfNodes > 10:
print("the number of nodes must be between 2 and 10") print("the number of nodes must be between 2 and 10")
exit(0) exit(0)
self.clearEnv()
self.createDirs()
self.updateLocalhosts() self.updateLocalhosts()
self.deploy() self.deploy()
def run(self): def run(self):
cmd = "./buildClusterEnv.sh -n %d -v %s -d %s" % (self.numOfNodes, self.getTaosdVersion(), self.dockerDir) cmd = "./buildClusterEnv.sh -n %d -v %s -d %s" % (self.numOfNodes, self.getTaosdVersion(), self.dockerDir)
display = "echo %s" % cmd
self.execCmd(display)
self.execCmd(cmd) self.execCmd(cmd)
self.getConnection() self.getConnection()
self.createDondes() self.createDondes()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册