本文整理汇总了Python中lib.tarantool_server.TarantoolServer.id方法的典型用法代码示例。如果您正苦于以下问题:Python TarantoolServer.id方法的具体用法?Python TarantoolServer.id怎么用?Python TarantoolServer.id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.tarantool_server.TarantoolServer
的用法示例。
在下文中一共展示了TarantoolServer.id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: range
# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import id [as 别名]
for i in range(REPLICA_N - 1):
server = TarantoolServer(server.ini)
server.script = 'replication/replica.lua'
server.vardir = os.path.join(server.vardir, 'replica', str(master.id + i))
server.rpl_master = master
server.deploy()
# Wait replica to fully bootstrap.
# Otherwise can get ACCESS_DENIED error.
server.wait_lsn(master.id, master_lsn)
cluster.append(server)
# Make a list of servers
sources = []
for server in cluster:
sources.append(yaml.load(server.admin('box.cfg.listen', silent = True))[0])
server.id = server.get_param('server')['id']
print 'done'
print '----------------------------------------------------------------------'
print 'Make a full mesh'
print '----------------------------------------------------------------------'
# Connect each server to each other to make full mesh
for server in cluster:
server.iproto.py_con.eval("box.cfg { replication_source = ... }", [sources])
# Wait connections to establish
for server in cluster:
for server2 in cluster:
server.iproto.py_con.eval("""
示例2: range
# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import id [as 别名]
cluster = [ master ]
for i in range(REPLICA_N - 1):
server = TarantoolServer(server.ini)
server.script = 'replication-py/replica.lua'
server.vardir = os.path.join(server.vardir, 'replica', str(master.id + i))
server.rpl_master = master
server.deploy()
# Wait replica to fully bootstrap.
# Otherwise can get ACCESS_DENIED error.
cluster.append(server)
# Make a list of servers
sources = []
for server in cluster:
sources.append(yaml.safe_load(server.admin('box.cfg.listen', silent = True))[0])
server.id = server.get_param('id')
print 'done'
print '----------------------------------------------------------------------'
print 'Make a full mesh'
print '----------------------------------------------------------------------'
# Connect each server to each other to make full mesh
for server in cluster:
server.iproto.py_con.eval("box.cfg { replication = ... }", [sources])
# Wait connections to establish
for server in cluster:
for server2 in cluster:
server.iproto.py_con.eval("""