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

Python mongoctl_logging.log_info函数代码示例

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

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



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

示例1: show_cluster_command

def show_cluster_command(parsed_options):
    cluster = repository.lookup_cluster(parsed_options.cluster)
    if cluster is None:
        raise MongoctlException("Could not find cluster '%s'." %
                                parsed_options.cluster)
    log_info("Configuration for cluster '%s':" % parsed_options.cluster)
    print cluster
开发者ID:Mat-Loz,项目名称:mongoctl,代码行数:7,代码来源:show.py


示例2: do_mongo_restore

def do_mongo_restore(source,
                     host=None,
                     port=None,
                     dbpath=None,
                     database=None,
                     username=None,
                     password=None,
                     version_info=None,
                     restore_options=None):


    # create restore command with host and port
    restore_cmd = [get_mongo_restore_executable(version_info)]

    if host:
        restore_cmd.extend(["--host", host])
    if port:
        restore_cmd.extend(["--port", str(port)])

    # dbpath
    if dbpath:
        restore_cmd.extend(["--dbpath", dbpath])

    # database
    if database:
        restore_cmd.extend(["-d", database])

    # username and password
    if username:
        restore_cmd.extend(["-u", username, "-p"])
        if password:
            restore_cmd.append(password)

    # ignore authenticationDatabase option is version_info is less than 2.4.0
    if (restore_options and "authenticationDatabase" in restore_options and
            version_info and version_info < make_version_info("2.4.0")):
        restore_options.pop("authenticationDatabase", None)

    # ignore restoreDbUsersAndRoles option is version_info is less than 2.6.0
    if (restore_options and "restoreDbUsersAndRoles" in restore_options and
            version_info and version_info < make_version_info("2.6.0")):
        restore_options.pop("restoreDbUsersAndRoles", None)

    # append shell options
    if restore_options:
        restore_cmd.extend(options_to_command_args(restore_options))

    # pass source arg
    restore_cmd.append(source)

    cmd_display =  restore_cmd[:]
    # mask user/password
    if username:
        cmd_display[cmd_display.index("-u") + 1] =  "****"
        if password:
            cmd_display[cmd_display.index("-p") + 1] =  "****"

    # execute!
    log_info("Executing command: \n%s" % " ".join(cmd_display))
    call_command(restore_cmd, bubble_exit_code=True)
开发者ID:zenglzh,项目名称:mongoctl,代码行数:60,代码来源:restore.py


示例3: show_server_command

def show_server_command(parsed_options):
    server = repository.lookup_server(parsed_options.server)
    if server is None:
        raise MongoctlException("Could not find server '%s'." %
                                parsed_options.server)
    log_info("Configuration for server '%s':" % parsed_options.server)
    print server
开发者ID:Mat-Loz,项目名称:mongoctl,代码行数:7,代码来源:show.py


示例4: set_runtime_parameter_cmd

 def set_runtime_parameter_cmd(self, name, value):
     log_info("Setting runtime parameter '%s' to '%s', for server '%s'..." %
              (name, value, self.id))
     cmd = {
         "setParameter": 1,
         name: value
     }
     self.db_command(cmd, "admin")
开发者ID:mongolab,项目名称:mongoctl,代码行数:8,代码来源:mongod.py


示例5: configure_sharded_cluster

    def configure_sharded_cluster(self):
        sh_list = self.list_shards()
        if sh_list and sh_list.get("shards"):
            log_info("Shard cluster already configured. Will only be adding"
                     " new shards as needed...")

        for shard_member in self.shards:
            self.add_shard(shard_member.get_shard())
开发者ID:hongchoi,项目名称:mongoctl,代码行数:8,代码来源:sharded_cluster.py


示例6: do_mongo_dump

def do_mongo_dump(host=None,
                  port=None,
                  dbpath=None,
                  database=None,
                  username=None,
                  password=None,
                  version_info=None,
                  dump_options=None):


    # create dump command with host and port
    dump_cmd = [get_mongo_dump_executable(version_info)]

    if host:
        dump_cmd.extend(["--host", host])
    if port:
        dump_cmd.extend(["--port", str(port)])

    # dbpath
    if dbpath:
        dump_cmd.extend(["--dbpath", dbpath])

    # database
    if database:
        dump_cmd.extend(["-d", database])

    # username and password
    if username:
        dump_cmd.extend(["-u", username, "-p"])
        if password:
            dump_cmd.append(password)

    # ignore authenticationDatabase option is version_info is less than 2.4.0
    if (dump_options and "authenticationDatabase" in dump_options and
            version_info and version_info < VersionInfo("2.4.0")):
        dump_options.pop("authenticationDatabase", None)

    # ignore dumpDbUsersAndRoles option is version_info is less than 2.6.0
    if (dump_options and "dumpDbUsersAndRoles" in dump_options and
            version_info and version_info < VersionInfo("2.6.0")):
        dump_options.pop("dumpDbUsersAndRoles", None)

    # append shell options
    if dump_options:
        dump_cmd.extend(options_to_command_args(dump_options))


    cmd_display =  dump_cmd[:]
    # mask user/password
    if username:
        cmd_display[cmd_display.index("-u") + 1] = "****"
        if password:
            cmd_display[cmd_display.index("-p") + 1] =  "****"



    log_info("Executing command: \n%s" % " ".join(cmd_display))
    call_command(dump_cmd, bubble_exit_code=True)
开发者ID:macroeyes,项目名称:mongoctl,代码行数:58,代码来源:dump.py


示例7: do_restart_server

def do_restart_server(server, options_override=None):
    log_info("Restarting server '%s'..." % server.id)

    if server.is_online():
        do_stop_server(server)
    else:
        log_info("Server '%s' is not running." % server.id)

    do_start_server(server, options_override)
开发者ID:Mat-Loz,项目名称:mongoctl,代码行数:9,代码来源:restart.py


示例8: extract_archive

def extract_archive(archive_name):
    log_info("Extracting %s..." % archive_name)
    if not which("tar"):
        msg = ("Cannot extract archive.You need to have 'tar' command in your"
               " path in order to proceed.")
        raise MongoctlException(msg)

    tar_cmd = ['tar', 'xvf', archive_name]
    call_command(tar_cmd)
开发者ID:Mat-Loz,项目名称:mongoctl,代码行数:9,代码来源:install.py


示例9: get_environment_variables

    def get_environment_variables(self):
        env_vars = super(MongodServer, self).get_environment_variables() or {}

        # default TCMALLOC_AGGRESSIVE_DECOMMIT as needed if not set
        if "TCMALLOC_AGGRESSIVE_DECOMMIT" not in env_vars and self.needs_tcmalloc_aggressive_decommit():
            log_info("Defaulting TCMALLOC_AGGRESSIVE_DECOMMIT=y")
            env_vars["TCMALLOC_AGGRESSIVE_DECOMMIT"] = "y"

        return env_vars
开发者ID:mongolab,项目名称:mongoctl,代码行数:9,代码来源:mongod.py


示例10: remove_shard

    def remove_shard(self, shard, unsharded_data_dest_id=None, synchronized=False):
        log_info("Removing shard '%s' from shardset '%s' " % (shard.id, self.id))

        configured_shards = self.list_shards()
        log_info("Current configured shards: \n%s" % document_pretty_string(configured_shards))

        completed = False
        while not completed:
            result = self._do_remove_shard(shard, unsharded_data_dest_id)
            completed = synchronized and (result["state"] == "completed" or not self.is_shard_configured(shard))
            if not completed:
                time.sleep(2)
开发者ID:hillct,项目名称:mongoctl,代码行数:12,代码来源:shardset_cluster.py


示例11: verify_runtime_parameters

    def verify_runtime_parameters(self):
        log_info("Verifying runtime params...")
        wtcs_gb = self.get_cmd_option("wiredTigerCacheSizeGB")
        if wtcs_gb is not None and isinstance(wtcs_gb, float):
            wtcs_bytes = int(wtcs_gb * 1024 * 1024 * 1024)
            server_status = self.server_status()
            if not(server_status and "wiredTiger" in server_status and "cache" in server_status["wiredTiger"] and
                           "maximum bytes configured" in server_status["wiredTiger"]["cache"] and
                           server_status["wiredTiger"]["cache"]["maximum bytes configured"] == wtcs_bytes):
                raise MongoctlException("CONFIG ERROR: wiredTigerCacheSizeGB was not applied")

        log_info("Runtime params verification passed!")
开发者ID:mongolab,项目名称:mongoctl,代码行数:12,代码来源:mongod.py


示例12: do_open_mongo_shell_to

def do_open_mongo_shell_to(address,
                           database=None,
                           username=None,
                           password=None,
                           server_version=None,
                           shell_options=None,
                           js_files=None,
                           ssl=False):

    # default database to admin
    database = database if database else "admin"

    shell_options = shell_options or {}
    js_files = js_files or []

    # override port if specified in --port
    if "port" in shell_options:
        address = "%s:%s" % (address.split(":")[0], shell_options["port"])
        # remove port from options since passing address + port is disallowed in mongo
        del shell_options["port"]
    connect_cmd = [get_mongo_shell_executable(server_version),
                   "%s/%s" % (address, database)]

    if username:
        connect_cmd.extend(["-u",username, "-p"])
        if password:
            connect_cmd.extend([password])

    # append shell options
    if shell_options:
        connect_cmd.extend(options_to_command_args(shell_options))

    # append js files
    if js_files:
        connect_cmd.extend(js_files)

    # ssl options
    if ssl and "--ssl" not in connect_cmd:
        connect_cmd.append("--ssl")

    cmd_display = connect_cmd[:]
    # mask user/password
    if username:
        cmd_display[cmd_display.index("-u") + 1] =  "****"
        if password:
            cmd_display[cmd_display.index("-p") + 1] =  "****"

    log_info("Executing command: \n%s" % " ".join(cmd_display))
    call_command(connect_cmd, bubble_exit_code=True)
开发者ID:mongolab,项目名称:mongoctl,代码行数:49,代码来源:connect.py


示例13: dry_run_configure_cluster

def dry_run_configure_cluster(cluster, force_primary_server_id=None):
    log_info("\n************ Dry Run ************\n")
    db_command = None
    force = force_primary_server_id is not None
    if cluster.is_replicaset_initialized():
        log_info("Replica set already initialized. "
                 "Making the replSetReconfig command...")
        db_command = cluster.get_replicaset_reconfig_db_command(force=force)
    else:
        log_info("Replica set has not yet been initialized."
                 " Making the replSetInitiate command...")
        db_command = cluster.get_replicaset_init_all_db_command()

    log_info("Executing the following command on the current primary:")
    log_info(document_pretty_string(db_command))
开发者ID:Mat-Loz,项目名称:mongoctl,代码行数:15,代码来源:configure.py


示例14: list_servers_command

def list_servers_command(parsed_options):
    servers = repository.lookup_all_servers()
    if not servers or len(servers) < 1:
        log_info("No servers have been configured.")
        return

    servers = sorted(servers, key=lambda s: s.id)
    bar = "-" * 80
    print bar
    formatter = "%-25s %-40s %s"
    print formatter % ("_ID", "DESCRIPTION", "CONNECT TO")
    print bar

    for server in servers:
        print formatter % (server.id, to_string(server.get_description()), to_string(server.get_address_display()))
    print "\n"
开发者ID:hongchoi,项目名称:mongoctl,代码行数:16,代码来源:list_servers.py


示例15: download

def download(url):
    log_info("Downloading %s..." % url)

    if which("curl"):
        download_cmd = ['curl', '-O']
        if not is_interactive_mode():
            download_cmd.append('-Ss')
    elif which("wget"):
        download_cmd = ['wget']
    else:
        msg = ("Cannot download file.You need to have 'curl' or 'wget"
               "' command in your path in order to proceed.")
        raise MongoctlException(msg)

    download_cmd.append(url)
    call_command(download_cmd)
开发者ID:Mat-Loz,项目名称:mongoctl,代码行数:16,代码来源:install.py


示例16: mongo_dump_cluster_primary

def mongo_dump_cluster_primary(cluster,
                               database=None,
                               username=None,
                               password=None,
                               dump_options=None):
    log_info("Locating default server for cluster '%s'..." % cluster.id)
    default_server = cluster.get_default_server()
    if default_server:
        log_info("Dumping default server '%s'..." % default_server.id)
        mongo_dump_server(default_server,
                          database=database,
                          username=username,
                          password=password,
                          dump_options=dump_options)
    else:
        raise MongoctlException("No default server found for cluster '%s'" %
                                cluster.id)
开发者ID:mongolab,项目名称:mongoctl,代码行数:17,代码来源:dump.py


示例17: add_shard

    def add_shard(self, shard):
        log_info("Adding shard '%s' to shardset '%s' " % (shard.id, self.id))

        if self.is_shard_configured(shard):
            log_info("Shard '%s' already added! Nothing to do..." % shard.id)
            return

        mongos = self.get_any_online_mongos()
        shard_member = self.get_shard_member(shard)
        cmd = self.get_add_shard_command(shard_member)

        configured_shards = self.list_shards()
        log_info("Current configured shards: \n%s" % document_pretty_string(configured_shards))

        log_info("Executing command \n%s\non mongos '%s'" % (document_pretty_string(cmd), mongos.id))
        mongos.db_command(cmd, "admin")

        log_info("Shard '%s' added successfully!" % self.id)
开发者ID:hillct,项目名称:mongoctl,代码行数:18,代码来源:shardset_cluster.py


示例18: mongo_restore_cluster

def mongo_restore_cluster(cluster, source,
                          database=None,
                          username=None,
                          password=None,
                          restore_options=None):
    repository.validate_cluster(cluster)
    log_info("Locating default server for cluster '%s'..." % cluster.id)
    default_server = cluster.get_default_server()
    if default_server:
        log_info("Restoring default server '%s'" % default_server.id)
        mongo_restore_server(default_server, source,
                             database=database,
                             username=username,
                             password=password,
                             restore_options=restore_options)
    else:
        raise MongoctlException("No default server found for cluster '%s'" %
                                cluster.id)
开发者ID:zenglzh,项目名称:mongoctl,代码行数:18,代码来源:restore.py


示例19: do_open_mongo_shell_to

def do_open_mongo_shell_to(address,
                           database=None,
                           username=None,
                           password=None,
                           server_version=None,
                           shell_options={},
                           js_files=[],
                           ssl=False):

    # default database to admin
    database = database if database else "admin"


    connect_cmd = [get_mongo_shell_executable(server_version),
                   "%s/%s" % (address, database)]

    if username:
        connect_cmd.extend(["-u",username, "-p"])
        if password:
            connect_cmd.extend([password])

    # append shell options
    if shell_options:
        connect_cmd.extend(options_to_command_args(shell_options))

    # append js files
    if js_files:
        connect_cmd.extend(js_files)

    # ssl options
    if ssl:
        connect_cmd.append("--ssl")

    cmd_display =  connect_cmd[:]
    # mask user/password
    if username:
        cmd_display[cmd_display.index("-u") + 1] =  "****"
        if password:
            cmd_display[cmd_display.index("-p") + 1] =  "****"

    log_info("Executing command: \n%s" % " ".join(cmd_display))
    call_command(connect_cmd, bubble_exit_code=True)
开发者ID:macroeyes,项目名称:mongoctl,代码行数:42,代码来源:connect.py


示例20: open_mongo_shell_to_cluster

def open_mongo_shell_to_cluster(cluster,
                                database=None,
                                username=None,
                                password=None,
                                shell_options={},
                                js_files=[]):

    log_info("Locating default server for cluster '%s'..." % cluster.id)
    default_server = cluster.get_default_server()
    if default_server:
        log_info("Connecting to server '%s'" % default_server.id)
        open_mongo_shell_to_server(default_server,
                                   database=database,
                                   username=username,
                                   password=password,
                                   shell_options=shell_options,
                                   js_files=js_files)
    else:
        log_error("No default server found for cluster '%s'" %
                  cluster.id)
开发者ID:macroeyes,项目名称:mongoctl,代码行数:20,代码来源:connect.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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