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


Python TarantoolServer.get_param方法代码示例

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


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

示例1: TarantoolServer

# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import get_param [as 别名]
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)

# Start replica without master
开发者ID:DarkDare,项目名称:tarantool,代码行数:33,代码来源:readonly.test.py

示例2: TarantoolServer

# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import get_param [as 别名]
print '-------------------------------------------------------------'
print 'Start a new replica and check box.info on the start'
print '-------------------------------------------------------------'
# master server
master = server
master_id = master.get_param('id')

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

replica = TarantoolServer(server.ini)
replica.script = 'replication-py/replica.lua'
replica.vardir = server.vardir
replica.rpl_master = master
replica.deploy()
replica_id = replica.get_param('id')
replica_uuid = replica.get_param('uuid')
sys.stdout.push_filter(replica_uuid, '<replica uuid>')

replica.admin('box.info.id == %d' % replica_id)
replica.admin('not box.info.ro')
replica.admin('box.info.lsn == 0')
replica.admin('box.info.vclock[%d] == nil' % replica_id)

print '-------------------------------------------------------------'
print 'Modify data to bump LSN and check box.info'
print '-------------------------------------------------------------'
replica.admin('box.space._schema:insert{"test", 48}')
replica.admin('box.info.lsn == 1')
replica.admin('box.info.vclock[%d] == 1' % replica_id)
开发者ID:tarantool,项目名称:tarantool,代码行数:31,代码来源:cluster.test.py

示例3: range

# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import get_param [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

示例4: TarantoolServer

# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import get_param [as 别名]
import time

from lib.tarantool_server import TarantoolServer

# master server
master = server
master.admin("box.schema.user.grant('guest', 'read,write,execute', 'universe')")

# replica server
replica = TarantoolServer()
replica.script = "replication/replica.lua"
replica.rpl_master = master
replica.vardir = os.path.join(master.vardir, 'replica')
replica.deploy()

replica.get_param('node')

cycles = 0
status = replica.admin.execute_no_reconnect("box.info.status", True)
while (re.search(r'replica/.*/(connecting|connected)\n', status) == None and cycles < 500):
    time.sleep(0.01)
    status = replica.admin.execute_no_reconnect("box.info.status", True)
    cycles += 1
print(re.search(r'replica/.*/(connecting|connected)\n', status) != None)

master.stop()
cycles = 0

while (re.search(r'replica/.*/(connecting|failed)\n', status) == None and cycles < 500):
    time.sleep(0.01)
    status = replica.admin.execute_no_reconnect("box.info.status", True)
开发者ID:DarkDare,项目名称:tarantool,代码行数:33,代码来源:status.test.py

示例5: insert_tuples

# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import get_param [as 别名]
    # insert to master
    insert_tuples(master, id, id + ID_STEP)
    # select from replica
    select_tuples(replica, id, id + ID_STEP, master.get_param("lsn"))
    id += ID_STEP

    print "swap servers"
    # reconfigure replica to master
    replica.reconfigure("replication/cfg/replica_to_master.cfg", silent = False)
    # reconfigure master to replica
    master.reconfigure("replication/cfg/master_to_replica.cfg", silent = False)

    # insert to replica
    insert_tuples(replica, id, id + ID_STEP)
    # select from master
    select_tuples(master, id, id + ID_STEP, replica.get_param("lsn"))
    id += ID_STEP

    # insert to replica
    insert_tuples(replica, id, id + ID_STEP)
    # select from master
    select_tuples(master, id, id + ID_STEP, replica.get_param("lsn"))
    id += ID_STEP

    print "rollback servers configuration"
    # reconfigure replica to master
    master.reconfigure("replication/cfg/master.cfg", silent = False)
    # reconfigure master to replica
    replica.reconfigure("replication/cfg/replica.cfg", silent = False)

开发者ID:mkevac,项目名称:tarantool,代码行数:31,代码来源:swap.test.py

示例6: TarantoolServer

# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import get_param [as 别名]
os.putenv('MASTER_PORT', master.uri)

# replica server
replica = TarantoolServer()
replica.script = "replication/replica.lua"
replica.vardir = os.path.join(server.vardir, 'replica')
replica.deploy()
replica.uri = '%s:%[email protected]%s:%s' % (LOGIN, PASSWORD, HOST, replica.sql.port)
replica.admin("while box.space['_priv']:len() < 1 do require('fiber').sleep(0.01) end")
replica.sql.py_con.authenticate(LOGIN, PASSWORD)

master.admin("s = box.schema.create_space('tweedledum', {id = 0})")
master.admin("s:create_index('primary', {type = 'hash'})")

## gh-343: replica.cc must not add login and password to proc title
status = replica.get_param("status")
host_port = "%s:%s" % (HOST, master.sql.port)
m = re.search(r'replica/(.*)/.*', status)
if not m or m.group(1) != host_port:
    print 'invalid box.info.status', status, 'expected host:port', host_port

master_id = master.get_param('node')['id']
replica_id = replica.get_param('node')['id']

id = ID_BEGIN
for i in range(REPEAT):
    print "test %d iteration" % i

    # insert to master
    insert_tuples(master, id, id + ID_STEP)
    # select from replica
开发者ID:sashka,项目名称:tarantool,代码行数:33,代码来源:swap.test.py

示例7: insert_tuples

# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import get_param [as 别名]
               replica.find_exe(self.args.builddir),
               os.path.join(self.args.vardir, "replica"))

# Id counter
id = 0


print "insert to master [%d, %d) entries" % (id, id + ID_STEP)
insert_tuples(master, id, id + ID_STEP, "mater")

print "select from replica [%d, %d) entries" % (id, id + ID_STEP)
select_tuples(replica, id, id + ID_STEP)
id += ID_STEP

print "master lsn = %s" % master.get_param("lsn")
print "replica lsn = %s" % replica.get_param("lsn")


print """
#
# mater lsn > replica lsn
#
"""
print """
# reconfigure replica to master
"""
replica.reconfigure("replication/cfg/replica_to_master.cfg")

print "insert to master [%d, %d) entries" % (id, id + ID_STEP)
insert_tuples(master, id, id + ID_STEP, "mater")
print "select from master [%d, %d) entries" % (id, id + ID_STEP)
开发者ID:catcher22,项目名称:tarantool,代码行数:33,代码来源:consistent.test.py

示例8: range

# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import get_param [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

示例9: TarantoolServer

# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import get_param [as 别名]
# master server
master = server
# replica server
replica = TarantoolServer()
replica.script = "replication/replica.lua"
replica.rpl_master = master
replica.vardir = os.path.join(server.vardir, 'replica')
replica.deploy()

master.admin("box.schema.user.grant('guest', 'read,write,execute', 'universe')")
replica.admin("while box.space['_priv']:len() < 1 do box.fiber.sleep(0.01) end")
master.admin("s = box.schema.create_space('tweedledum', {id = 0})")
master.admin("s:create_index('primary', {type = 'hash'})")

master_uuid = master.get_param('node')
replica_uuid = replica.get_param('node')

id = ID_BEGIN
for i in range(REPEAT):
    print "test %d iteration" % i

    # insert to master
    insert_tuples(master, id, id + ID_STEP)
    # select from replica
    replica.wait_lsn(master_uuid, master.get_lsn(master_uuid))
    select_tuples(replica, id, id + ID_STEP)
    id += ID_STEP

    # insert to master
    insert_tuples(master, id, id + ID_STEP)
    # select from replica
开发者ID:CameronNemo,项目名称:tarantool,代码行数:33,代码来源:swap.test.py

示例10: require

# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import get_param [as 别名]
replica.admin("while box.space['_priv']:len() < 1 do require('fiber').sleep(0.01) end")
replica.iproto.py_con.authenticate(LOGIN, PASSWORD)

for engine in engines:
    master.admin("s = box.schema.space.create('%s', { engine = '%s'})" % (engine, engine))
    master.admin("index = s:create_index('primary', {type = 'tree'})")

### gh-343: replica.cc must not add login and password to proc title
#status = replica.get_param("status")
#host_port = "%s:%s" % master.iproto.uri
#m = re.search(r'replica/(.*)/.*', status)
#if not m or m.group(1) != host_port:
#    print 'invalid box.info.status', status, 'expected host:port', host_port

master_id = master.get_param('id')
replica_id = replica.get_param('id')

id = ID_BEGIN
for i in range(REPEAT):
    print "test %d iteration" % i

    # insert to master
    insert_tuples(master, id, id + ID_STEP)
    # select from replica
    replica.wait_lsn(master_id, master.get_lsn(master_id))
    select_tuples(replica, id, id + ID_STEP)
    id += ID_STEP

    # insert to master
    insert_tuples(master, id, id + ID_STEP)
    # select from replica
开发者ID:tarantool,项目名称:tarantool,代码行数:33,代码来源:swap.test.py


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