当前位置: 首页>>代码示例>>Python>>正文


Python TarantoolServer.id方法代码示例

本文整理汇总了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("""
开发者ID:daurnimator,项目名称:tarantool,代码行数:33,代码来源:multi.test.py

示例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("""
开发者ID:tarantool,项目名称:tarantool,代码行数:33,代码来源:multi.test.py


注:本文中的lib.tarantool_server.TarantoolServer.id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。