コード例 #1
0
ファイル: swap.test.py プロジェクト: sashka/tarantool
        _server.sql("select * from t0 where k0 = %d" % i)

# master server
master = server
master.admin("box.schema.user.create('%s', { password = '******'})" % (LOGIN, PASSWORD))
master.admin("box.schema.user.grant('%s', 'read,write,execute', 'universe')" % LOGIN)
master.sql.py_con.authenticate(LOGIN, PASSWORD)
master.uri = '%s:%s@%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:%s@%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']
コード例 #2
0
ファイル: swap.test.py プロジェクト: Mons/tarantool
# master server
master = server
master.admin("box.schema.user.create('%s', { password = '******'})" % (LOGIN, PASSWORD))
master.admin("box.schema.user.grant('%s', 'read,write,execute', 'universe')" % LOGIN)
master.sql.py_con.authenticate(LOGIN, PASSWORD)
master.uri = '%s:%s@%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:%s@%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']
コード例 #3
0
ファイル: swap.test.py プロジェクト: ztarvos/tarantool
master.deploy()
master.admin("box.schema.user.create('%s', { password = '******'})" %
             (LOGIN, PASSWORD))
master.admin("box.schema.user.grant('%s', 'read,write,execute', 'universe')" %
             LOGIN)
master.iproto.py_con.authenticate(LOGIN, PASSWORD)
master.uri = '%s:%s@%s' % (LOGIN, PASSWORD, master.iproto.uri)
os.putenv('MASTER', master.uri)

# replica server
replica = TarantoolServer()
replica.script = "replication-py/replica.lua"
replica.vardir = server.vardir  #os.path.join(server.vardir, 'replica')
replica.deploy()
replica.admin("while box.info.id == 0 do require('fiber').sleep(0.01) end")
replica.uri = '%s:%s@%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
コード例 #4
0
ファイル: swap.test.py プロジェクト: DarkDare/tarantool
master.stop()
master.cleanup()
master.deploy()
master.admin("box.schema.user.create('%s', { password = '******'})" % (LOGIN, PASSWORD))
master.admin("box.schema.user.grant('%s', 'read,write,execute', 'universe')" % LOGIN)
master.iproto.py_con.authenticate(LOGIN, PASSWORD)
master.uri = '%s:%s@%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:%s@%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']
コード例 #5
0
master.admin("box.schema.user.create('{}', {{ password = '******'}})".format(
    LOGIN, PASSWORD))
master.admin(
    "box.schema.user.grant('{}', 'read,write,execute', 'universe')".format(
        LOGIN))
master.iproto.py_con.authenticate(LOGIN, PASSWORD)
master.uri = "{}:{}@{}".format(LOGIN, PASSWORD, master.iproto.uri)
os.putenv("MASTER", master.uri)

# replica server
replica = TarantoolServer()
replica.script = "replication-py/replica.lua"
replica.vardir = server.vardir
replica.deploy()
replica.admin("while box.info.id == 0 do require('fiber').sleep(0.01) end")
replica.uri = "{}:{}@{}".format(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('{}', {{ engine = '{}'}})".format(
            engine, engine))
    master.admin("index = s:create_index('primary', {type = 'tree'})")

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

id = ID_BEGIN
for i in range(REPEAT):