• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python utils.zk_setup函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中utils.zk_setup函数的典型用法代码示例。如果您正苦于以下问题:Python zk_setup函数的具体用法?Python zk_setup怎么用?Python zk_setup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了zk_setup函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:7,代码来源:update_stream.py


示例2: setUpModule

def setUpModule():
  try:
    utils.zk_setup()

  except:
    tearDownModule()
    raise
开发者ID:iamima,项目名称:vitess,代码行数:7,代码来源:zkocc_test.py


示例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)
开发者ID:ShawnShoper,项目名称:WeShare,代码行数:10,代码来源:sharded.py


示例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)
开发者ID:ShawnShoper,项目名称:WeShare,代码行数:11,代码来源:tabletmanager.py


示例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
开发者ID:miffa,项目名称:golang-stuff,代码行数:11,代码来源:vtctld_test.py


示例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
开发者ID:ZhuoRoger,项目名称:vitess,代码行数:11,代码来源:update_stream.py


示例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)
开发者ID:Eric-Chen,项目名称:vitess,代码行数:13,代码来源:schema.py


示例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
开发者ID:CERN-Stage-3,项目名称:vitess,代码行数:14,代码来源:sharded.py


示例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()
开发者ID:ShawnShoper,项目名称:WeShare,代码行数:14,代码来源:update_stream.py


示例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
开发者ID:521wangzhifeng,项目名称:vitess,代码行数:15,代码来源:tabletmanager.py


示例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
开发者ID:CERN-Stage-3,项目名称:vitess,代码行数:16,代码来源:vtdb_test.py


示例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)
开发者ID:CERN-Stage-3,项目名称:vitess,代码行数:66,代码来源:test_env.py


示例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",
#.........这里部分代码省略.........
开发者ID:bigrats,项目名称:vitess,代码行数:101,代码来源:secure.py


示例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,
#.........这里部分代码省略.........
开发者ID:Eric-Chen,项目名称:vitess,代码行数:101,代码来源:secure.py


示例15: setup

def setup():
  utils.prog_compile(['zkclient2',
                      ])
  utils.zk_setup()
开发者ID:ShawnShoper,项目名称:WeShare,代码行数:4,代码来源:zkocc.py


示例16: setUp

    def setUp(self):
        utils.zk_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.querylog = framework.Tailer(open(self.tablet.querylog_file, "r"))
                self.log = framework.Tailer(open(self.tablet.logfile, "r"))
                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", "r"))
                return
            except dbexceptions.OperationalError:
                if i == 29:
                    raise
                time.sleep(1)
开发者ID:Eric-Chen,项目名称:vitess,代码行数:63,代码来源:test_env.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.zk_teardown函数代码示例发布时间:2022-05-26
下一篇:
Python utils.xprint函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap