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


Python TarantoolServer.uri方法代码示例

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


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

示例1: TarantoolServer

# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import uri [as 别名]
# master server
master = server
master.admin("box.schema.user.create('%s', { password = '%s'})" % (LOGIN, PASSWORD))
master.admin("box.schema.user.grant('%s', 'read,write,execute', 'universe')" % LOGIN)
master.sql.py_con.authenticate(LOGIN, PASSWORD)
master.uri = '%s:%[email protected]%s' % (LOGIN, PASSWORD, master.sql.uri)
os.putenv('MASTER', master.uri)

# replica server
replica = TarantoolServer()
replica.script = "replication/replica.lua"
replica.vardir = os.path.join(server.vardir, 'replica')
replica.deploy()
replica.admin("while box.info.server.id == 0 do require('fiber').sleep(0.01) end")
replica.uri = '%s:%[email protected]%s' % (LOGIN, PASSWORD, replica.sql.uri)
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.space.create('tweedledum', {id = 0})")
master.admin("index = 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" % master.sql.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('server')['id']
replica_id = replica.get_param('server')['id']
开发者ID:Mons,项目名称:tarantool,代码行数:32,代码来源:swap.test.py

示例2: TarantoolServer

# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import uri [as 别名]
        _server.sql("select * from t0 where k0 = %d" % i)

# master server
master = server
master.admin("box.schema.user.create('%s', { password = '%s'})" % (LOGIN, PASSWORD))
master.admin("box.schema.user.grant('%s', 'read,write,execute', 'universe')" % LOGIN)
master.sql.py_con.authenticate(LOGIN, PASSWORD)
master.uri = '%s:%[email protected]%s:%s' % (LOGIN, PASSWORD, HOST, master.sql.port)
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:sashka,项目名称:tarantool,代码行数:33,代码来源:swap.test.py

示例3: TarantoolServer

# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import uri [as 别名]
master.stop()
master.cleanup()
master.deploy()
master.admin("box.schema.user.create('%s', { password = '%s'})" % (LOGIN, PASSWORD))
master.admin("box.schema.user.grant('%s', 'read,write,execute', 'universe')" % LOGIN)
master.iproto.py_con.authenticate(LOGIN, PASSWORD)
master.uri = '%s:%[email protected]%s' % (LOGIN, PASSWORD, master.iproto.uri)
os.putenv('MASTER', master.uri)

# replica server
replica = TarantoolServer()
replica.script = "replication/replica.lua"
replica.vardir = server.vardir #os.path.join(server.vardir, 'replica')
replica.deploy()
replica.admin("while box.info.server.id == 0 do require('fiber').sleep(0.01) end")
replica.uri = '%s:%[email protected]%s' % (LOGIN, PASSWORD, replica.iproto.uri)
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('server')['id']
开发者ID:DarkDare,项目名称:tarantool,代码行数:33,代码来源:swap.test.py


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