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


Python TarantoolServer.wait_lsn方法代码示例

本文整理汇总了Python中lib.tarantool_server.TarantoolServer.wait_lsn方法的典型用法代码示例。如果您正苦于以下问题:Python TarantoolServer.wait_lsn方法的具体用法?Python TarantoolServer.wait_lsn怎么用?Python TarantoolServer.wait_lsn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lib.tarantool_server.TarantoolServer的用法示例。


在下文中一共展示了TarantoolServer.wait_lsn方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TarantoolServer

# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import wait_lsn [as 别名]
import os
from glob import iglob as glob
from lib.tarantool_server import TarantoolServer

# master server
master = server
master_id = master.get_param('server')['id']

master.admin("box.schema.user.grant('guest', 'replication')")

replica = TarantoolServer(server.ini)
replica.script = 'replication/replica.lua'
replica.vardir = server.vardir #os.path.join(server.vardir, 'replica')
replica.rpl_master = master
replica.deploy()
replica.wait_lsn(master_id, master.get_lsn(master_id))
replica_id = replica.get_param('server')['id']
replica.admin('box.info.server.id')
replica.admin('box.info.server.ro')
replica.admin('box.info.server.lsn')
replica.stop()

print '-------------------------------------------------------------'
print 'replica is read-only until receive self server_id in _cluster'
print '-------------------------------------------------------------'

# Remove xlog retrived by SUBSCRIBE
filename = str(0).zfill(20) + ".xlog"
wal = os.path.join(os.path.join(replica.vardir, replica.name), filename)
os.remove(wal)
开发者ID:DarkDare,项目名称:tarantool,代码行数:32,代码来源:readonly.test.py

示例2: TarantoolServer

# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import wait_lsn [as 别名]
replica.stop()
replica.cleanup(True)

master.admin('box.snapshot()')
master.restart()
master.admin('for k = 10, 19 do box.space[42]:insert{k, k*k*k} end')
lsn = master.get_param('lsn')
print '-------------------------------------------------------------'
print 'replica test 2 (must be ok)'
print '-------------------------------------------------------------'

replica = TarantoolServer(server.ini)
replica.cfgfile_source = 'replication/cfg/replica.cfg'
replica.vardir = os.path.join(server.vardir, 'replica')
replica.rpl_master = master
replica.deploy()

replica.admin('space = box.space.test');
replica.wait_lsn(lsn)
for i in range(1, 20):
    replica.admin('space:get{%d}' % i)

replica.stop()
replica.cleanup(True)

server.stop()
server.cfgfile_source = cfgfile_backup
server.deploy()

开发者ID:bigbes,项目名称:tarantool,代码行数:30,代码来源:init_storage.test.py

示例3: range

# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import wait_lsn [as 别名]
"""
for i in range(id, id + 10):
    master_sql("insert into t0 values (%d, 'the tuple %d')" % (i, i))


print """
# Select 10 tuples from master
"""
for i in range(id, id + 10):
    master_sql("select * from t0 where k0 = %d" % i)


print """
# Select 10 tuples from replica
"""
replica.wait_lsn(11)
for i in range(id, id + 10):
    replica_sql("select * from t0 where k0 = %d" % i)


print """
# Shutdown master server (now the hot_standby must be a primary server)
"""
server.stop()

id += 10

# White while hot_standby server not bind masters ports
time.sleep(0.2)

print """
开发者ID:catcher22,项目名称:tarantool,代码行数:33,代码来源:hot_standby.test.py

示例4: TarantoolServer

# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import wait_lsn [as 别名]
master.admin("box.schema.user.grant('guest', 'replication')")
master.admin("space = box.schema.space.create('test', { id = 99999, engine = \"sophia\" })")
master.admin("index = space:create_index('primary', { type = 'tree'})")
master.admin('for k = 1, 123 do space:insert{k, k*k} end')
master.admin('box.snapshot()')
lsn = master.get_lsn(master_id)

print '-------------------------------------------------------------'
print 'replica JOIN'
print '-------------------------------------------------------------'

# replica server
replica = TarantoolServer(server.ini)
replica.script = 'replication/replica.lua'
replica.vardir = os.path.join(server.vardir, 'replica')
replica.rpl_master = master
replica.deploy()
replica.wait_lsn(master_id, lsn)
replica.admin('box.space.test:select()')

replica.stop()
replica.cleanup(True)

# remove space
master.admin("space:drop()")
master.admin('box.snapshot()')
master.admin("ffi = require('ffi')")
master.admin("ffi.cdef(\"int sophia_schedule(void);\")")
master.admin("ffi.C.sophia_schedule() >= 0")
开发者ID:Mons,项目名称:tarantool,代码行数:31,代码来源:sophia_join.test.py

示例5: replica_memcached

# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import wait_lsn [as 别名]
replica_memcached("get 1 2 3 4 5 7 8 9 10\r\n")

print """# get deleted value"""
replica_memcached("get 6\r\n")

print """# flush all k-v on master and try to get them from replica"""
master_memcached("flush_all\r\n", silent=True)
wait_for_empty_space(replica)
replica_memcached("get 10\r\n")


print """# check that expiration is working properly on replica"""
master_memcached("set 1 0 1 %d\r\n%s\r\n" % (len(sonet[0]), sonet[0]), silent=True)
lsn = wait()
replica_memcached("get 1\r\n")
replica.wait_lsn(lsn + 1)
replica_memcached("get 1\r\n")

print """# check that expiration is working properly, when replica becomes master"""
master_memcached("set 1 0 1 %d\r\n%s\r\n" % (len(sonet[0]), sonet[0]), silent=True)
lsn = wait()
replica.reconfigure("replication/cfg/replica_to_master.cfg")
replica_memcached("get 1\r\n")
replica.wait_lsn(lsn + 1)
replica_memcached("get 1\r\n")


# restore default suite config
replica.stop()
replica.cleanup(True)
master.stop()
开发者ID:catcher22,项目名称:tarantool,代码行数:33,代码来源:memcached.test.py

示例6: range

# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import wait_lsn [as 别名]
print 'Bootstrap replicas'
print '----------------------------------------------------------------------'

# Start replicas
master.id = master.get_param('server')['id']
master_lsn = master.get_lsn(master.id)
cluster = [ master ]
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
开发者ID:daurnimator,项目名称:tarantool,代码行数:33,代码来源:multi.test.py


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