本文整理汇总了Python中utils.zk_setup函数的典型用法代码示例。如果您正苦于以下问题:Python zk_setup函数的具体用法?Python zk_setup怎么用?Python zk_setup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zk_setup函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup
def setup():
utils.zk_setup()
# start mysql instance external to the test
setup_procs = [master_tablet.init_mysql(), replica_tablet.init_mysql()]
utils.wait_procs(setup_procs)
setup_tablets()
示例2: setUpModule
def setUpModule():
try:
utils.zk_setup()
except:
tearDownModule()
raise
示例3: setup
def setup():
utils.zk_setup()
setup_procs = [
shard_0_master.init_mysql(),
shard_0_replica.init_mysql(),
shard_1_master.init_mysql(),
shard_1_replica.init_mysql(),
]
utils.wait_procs(setup_procs)
示例4: setup
def setup():
utils.zk_setup()
# start mysql instance external to the test
setup_procs = [
tablet_62344.init_mysql(),
tablet_62044.init_mysql(),
tablet_41983.init_mysql(),
tablet_31981.init_mysql(),
]
utils.wait_procs(setup_procs)
示例5: setUpModule
def setUpModule():
try:
utils.zk_setup()
setup_procs = [t.init_mysql() for t in tablets]
utils.wait_procs(setup_procs)
vtctld.start()
except:
tearDownModule()
raise
示例6: setUpModule
def setUpModule():
try:
utils.zk_setup()
# start mysql instance external to the test
setup_procs = [master_tablet.init_mysql(), replica_tablet.init_mysql()]
utils.wait_procs(setup_procs)
setup_tablets()
except:
tearDownModule()
raise
示例7: setup
def setup():
utils.zk_setup()
setup_procs = [
shard_0_master.init_mysql(),
shard_0_replica1.init_mysql(),
shard_0_replica2.init_mysql(),
shard_0_rdonly.init_mysql(),
shard_0_backup.init_mysql(),
shard_1_master.init_mysql(),
shard_1_replica1.init_mysql(),
]
utils.wait_procs(setup_procs)
示例8: setUpModule
def setUpModule():
try:
utils.zk_setup()
setup_procs = [
shard_0_master.init_mysql(),
shard_0_replica.init_mysql(),
shard_1_master.init_mysql(),
shard_1_replica.init_mysql(),
]
utils.wait_procs(setup_procs)
except:
tearDownModule()
raise
示例9: setup
def setup():
utils.zk_setup()
utils.prog_compile(['mysqlctl',
'vtaction',
'vtctl',
'vttablet',
])
# start mysql instance external to the test
setup_procs = [master_tablet.init_mysql(),
replica_tablet.init_mysql()
]
utils.wait_procs(setup_procs)
setup_tablets()
示例10: setUpModule
def setUpModule():
try:
utils.zk_setup(add_bad_host=True)
# start mysql instance external to the test
setup_procs = [
tablet_62344.init_mysql(),
tablet_62044.init_mysql(),
tablet_41983.init_mysql(),
tablet_31981.init_mysql(),
]
utils.wait_procs(setup_procs)
except:
tearDownModule()
raise
示例11: setUpModule
def setUpModule():
logging.debug("in setUpModule")
try:
utils.zk_setup()
# start mysql instance external to the test
setup_procs = [shard_0_master.init_mysql(),
shard_0_replica.init_mysql(),
shard_1_master.init_mysql(),
shard_1_replica.init_mysql()
]
utils.wait_procs(setup_procs)
setup_tablets()
except:
tearDownModule()
raise
示例12: setUp
def setUp(self):
utils.zk_setup()
utils.setup()
if self.vttop is None:
raise EnvironmentError("VTTOP not defined")
if self.vtroot is None:
raise EnvironmentError("VTROOT not defined")
framework.execute('go build', verbose=utils.options.verbose, cwd=self.vttop+'/go/cmd/mysqlctl')
utils.wait_procs([self.tablet.init_mysql()])
self.tablet.mquery("", ["create database vt_test_keyspace", "set global read_only = off"])
self.mysql_conn, mcu = self.tablet.connect('vt_test_keyspace')
self.clean_sqls = []
self.init_sqls = []
clean_mode = False
with open(os.path.join(self.vttop, "test", "test_data", "test_schema.sql")) as f:
for line in f:
line = line.rstrip()
if line == "# clean":
clean_mode = True
if line=='' or line.startswith("#"):
continue
if clean_mode:
self.clean_sqls.append(line)
else:
self.init_sqls.append(line)
try:
for line in self.init_sqls:
mcu.execute(line, {})
finally:
mcu.close()
utils.run_vtctl('CreateKeyspace -force /zk/global/vt/keyspaces/test_keyspace')
self.tablet.init_tablet('master', 'test_keyspace', '0')
customrules = '/tmp/customrules.json'
self.create_customrules(customrules)
schema_override = '/tmp/schema_override.json'
self.create_schema_override(schema_override)
if utils.options.memcache:
self.tablet.start_vttablet(memcache=True, customrules=customrules, schema_override=schema_override)
else:
self.tablet.start_vttablet(customrules=customrules, schema_override=schema_override)
# FIXME(szopa): This is necessary here only because of a bug that
# makes the qs reload its config only after an action.
utils.run_vtctl('Ping ' + self.tablet.zk_tablet_path)
for i in range(30):
try:
self.conn = self.connect()
self.txlogger = subprocess.Popen(['curl', '-s', '-N', 'http://localhost:9461/debug/txlog'], stdout=open('/tmp/vtocc_txlog.log', 'w'))
self.txlog = framework.Tailer(open('/tmp/vtocc_txlog.log'), flush=self.tablet.flush)
self.log = framework.Tailer(open(os.path.join(self.tablet.tablet_dir, 'vttablet.INFO')), flush=self.tablet.flush)
querylog_file = '/tmp/vtocc_streamlog_%s.log' % self.tablet.port
utils.run_bg(['curl', '-s', '-N', 'http://localhost:9461/debug/querylog?full=true'], stdout=open(querylog_file, 'w'))
time.sleep(1)
self.querylog = framework.Tailer(open(querylog_file), sleep=0.1)
return
except dbexceptions.OperationalError:
if i == 29:
raise
time.sleep(1)
示例13: setUpModule
def setUpModule():
try:
utils.zk_setup()
logging.debug("Creating certificates")
os.makedirs(cert_dir)
# Create CA certificate
ca_key = cert_dir + "/ca-key.pem"
ca_cert = cert_dir + "/ca-cert.pem"
openssl(["genrsa", "-out", cert_dir + "/ca-key.pem"])
ca_config = cert_dir + "/ca.config"
with open(ca_config, 'w') as fd:
fd.write("""
[ req ]
default_bits = 1024
default_keyfile = keyfile.pem
distinguished_name = req_distinguished_name
attributes = req_attributes
prompt = no
output_password = mypass
[ req_distinguished_name ]
C = US
ST = California
L = Mountain View
O = Google
OU = Vitess
CN = Mysql CA
emailAddress = [email protected]
[ req_attributes ]
challengePassword = A challenge password
""")
openssl(["req", "-new", "-x509", "-nodes", "-days", "3600", "-batch",
"-config", ca_config,
"-key", ca_key,
"-out", ca_cert])
# Create mysql server certificate, remove passphrase, and sign it
server_key = cert_dir + "/server-key.pem"
server_cert = cert_dir + "/server-cert.pem"
server_req = cert_dir + "/server-req.pem"
server_config = cert_dir + "/server.config"
with open(server_config, 'w') as fd:
fd.write("""
[ req ]
default_bits = 1024
default_keyfile = keyfile.pem
distinguished_name = req_distinguished_name
attributes = req_attributes
prompt = no
output_password = mypass
[ req_distinguished_name ]
C = US
ST = California
L = Mountain View
O = Google
OU = Vitess
CN = Mysql Server
emailAddress = [email protected]
[ req_attributes ]
challengePassword = A challenge password
""")
openssl(["req", "-newkey", "rsa:2048", "-days", "3600", "-nodes", "-batch",
"-config", server_config,
"-keyout", server_key, "-out", server_req])
openssl(["rsa", "-in", server_key, "-out", server_key])
openssl(["x509", "-req",
"-in", server_req,
"-days", "3600",
"-CA", ca_cert,
"-CAkey", ca_key,
"-set_serial", "01",
"-out", server_cert])
# Create mysql client certificate, remove passphrase, and sign it
client_key = cert_dir + "/client-key.pem"
client_cert = cert_dir + "/client-cert.pem"
client_req = cert_dir + "/client-req.pem"
client_config = cert_dir + "/client.config"
with open(client_config, 'w') as fd:
fd.write("""
[ req ]
default_bits = 1024
default_keyfile = keyfile.pem
distinguished_name = req_distinguished_name
attributes = req_attributes
prompt = no
output_password = mypass
[ req_distinguished_name ]
C = US
ST = California
L = Mountain View
O = Google
OU = Vitess
CN = Mysql Client
emailAddress = [email protected]
[ req_attributes ]
challengePassword = A challenge password
""")
openssl(["req", "-newkey", "rsa:2048", "-days", "3600", "-nodes", "-batch",
#.........这里部分代码省略.........
示例14: setup
def setup():
utils.zk_setup()
utils.debug("Creating certificates")
os.makedirs(cert_dir)
# Create CA certificate
ca_key = cert_dir + "/ca-key.pem"
ca_cert = cert_dir + "/ca-cert.pem"
openssl(["genrsa", "-out", cert_dir + "/ca-key.pem"])
ca_config = cert_dir + "/ca.config"
with open(ca_config, 'w') as fd:
fd.write("""
[ req ]
default_bits = 1024
default_keyfile = keyfile.pem
distinguished_name = req_distinguished_name
attributes = req_attributes
prompt = no
output_password = mypass
[ req_distinguished_name ]
C = US
ST = California
L = Mountain View
O = Google
OU = Vitess
CN = Mysql CA
emailAddress = [email protected]
[ req_attributes ]
challengePassword = A challenge password
""")
openssl(["req", "-new", "-x509", "-nodes", "-days", "3600", "-batch",
"-config", ca_config,
"-key", ca_key,
"-out", ca_cert])
# Create mysql server certificate, remove passphrase, and sign it
server_key = cert_dir + "/server-key.pem"
server_cert = cert_dir + "/server-cert.pem"
server_req = cert_dir + "/server-req.pem"
server_config = cert_dir + "/server.config"
with open(server_config, 'w') as fd:
fd.write("""
[ req ]
default_bits = 1024
default_keyfile = keyfile.pem
distinguished_name = req_distinguished_name
attributes = req_attributes
prompt = no
output_password = mypass
[ req_distinguished_name ]
C = US
ST = California
L = Mountain View
O = Google
OU = Vitess
CN = Mysql Server
emailAddress = [email protected]
[ req_attributes ]
challengePassword = A challenge password
""")
openssl(["req", "-newkey", "rsa:2048", "-days", "3600", "-nodes", "-batch",
"-config", server_config,
"-keyout", server_key, "-out", server_req])
openssl(["rsa", "-in", server_key, "-out", server_key])
openssl(["x509", "-req",
"-in", server_req,
"-days", "3600",
"-CA", ca_cert,
"-CAkey", ca_key,
"-set_serial", "01",
"-out", server_cert])
# Create mysql client certificate, remove passphrase, and sign it
client_key = cert_dir + "/client-key.pem"
client_cert = cert_dir + "/client-cert.pem"
client_req = cert_dir + "/client-req.pem"
client_config = cert_dir + "/client.config"
with open(client_config, 'w') as fd:
fd.write("""
[ req ]
default_bits = 1024
default_keyfile = keyfile.pem
distinguished_name = req_distinguished_name
attributes = req_attributes
prompt = no
output_password = mypass
[ req_distinguished_name ]
C = US
ST = California
L = Mountain View
O = Google
OU = Vitess
CN = Mysql Client
emailAddress = [email protected]
[ req_attributes ]
challengePassword = A challenge password
""")
openssl(["req", "-newkey", "rsa:2048", "-days", "3600", "-nodes", "-batch",
"-config", client_config,
#.........这里部分代码省略.........
示例15: setup
def setup():
utils.prog_compile(['zkclient2',
])
utils.zk_setup()