提交 0f5ee107 编写于 作者: P Ping Xiao

add arbitrator for docker cluster test

上级 67a4114a
......@@ -150,14 +150,21 @@ if __name__ == "__main__":
cluster.init(numOfNodes, dataDir)
cluster.prepardBuild()
startArbitrator = False
arbitratorHost = "tdnode1"
for i in range(numOfNodes):
if ucase.updatecfgDict.get('%d' % (i + 1)) != None:
config = dict (ucase.updatecfgDict.get('%d' % (i + 1)))
print(config)
for key, value in config.items():
print(key, value, i + 1)
if key == "arbitrator":
startArbitrator = True
arbitratorHost = value
cluster.cfg(key, value, i + 1)
cluster.run()
if startArbitrator:
hostname=value.split(":")[0]
cluster.startArbitrator(hostname)
conn = cluster.conn
except Exception as e:
print(e.args)
......
......@@ -142,10 +142,8 @@ class BuildDockerCluser:
print("create dnode tdnode%d" % i)
self.cursor.execute("create dnode tdnode%d" % i)
def startArbitrator(self):
for i in range(1, self.numOfNodes + 1):
self.cfg("arbitrator", "tdnode1:6042", i)
cmd = "docker exec -d $(docker ps|grep tdnode1|awk '{print $1}') tarbitrator"
def startArbitrator(self, hostname = 'tdnode1'):
cmd = "docker exec -d $(docker ps|grep '%s'|awk '{print $1}') tarbitrator" % hostname
self.execCmd(cmd)
def prepardBuild(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册