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


Python ClusterOperationHelper.stop_cluster方法代码示例

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


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

示例1: save_snapshots

# 需要导入模块: from membase.helper.cluster_helper import ClusterOperationHelper [as 别名]
# 或者: from membase.helper.cluster_helper.ClusterOperationHelper import stop_cluster [as 别名]
    def save_snapshots(self, file_base, bucket):
        """Save snapshots on all servers"""
        if not self.input.servers or not bucket:
            print "[perf: save_snapshot] invalid server list or bucket name"
            return False

        ClusterOperationHelper.stop_cluster(self.input.servers)

        for server in self.input.servers:
            self._save_snapshot(server, bucket, file_base)

        ClusterOperationHelper.start_cluster(self.input.servers)

        return True
开发者ID:IrynaMironava,项目名称:testrunner,代码行数:16,代码来源:perf.py

示例2: set_up_dgm

# 需要导入模块: from membase.helper.cluster_helper import ClusterOperationHelper [as 别名]
# 或者: from membase.helper.cluster_helper.ClusterOperationHelper import stop_cluster [as 别名]
    def set_up_dgm(self):
        """Download fragmented, DGM dataset onto each cluster node, if not
        already locally available.

        The number of vbuckets and database schema must match the
        target cluster.

        Shutdown all cluster nodes.

        Do a cluster-restore.

        Restart all cluster nodes."""

        bucket = self.param("bucket", "default")
        ClusterOperationHelper.stop_cluster(self.input.servers)
        for server in self.input.servers:
            remote = RemoteMachineShellConnection(server)
            #TODO: Better way to pass num_nodes and db_size?
            self.get_data_files(remote, bucket, 1, 10)
            remote.disconnect()
        ClusterOperationHelper.start_cluster(self.input.servers)
开发者ID:IrynaMironava,项目名称:testrunner,代码行数:23,代码来源:perf.py

示例3: initialize

# 需要导入模块: from membase.helper.cluster_helper import ClusterOperationHelper [as 别名]
# 或者: from membase.helper.cluster_helper.ClusterOperationHelper import stop_cluster [as 别名]
    def initialize(self, params):
        start_time = time.time()
        cluster_initialized = False
        server = params["server"]
        remote_client = RemoteMachineShellConnection(params["server"])
        while time.time() < start_time + 5 * 60:
            try:
                rest = RestConnection(server)

                # Optionally change node name and restart server
                if params.get('use_domain_names', 0):
                    remote_client.set_node_name(server.ip)
                    rest.rename_node(server.ip)

                # Make sure that data_path and index_path are writable by couchbase user
                for path in set(filter(None, [server.data_path, server.index_path])):
                    time.sleep(3)

                    for cmd in ("rm -rf {0}/*".format(path),
                                "chown -R couchbase:couchbase {0}".format(path)):
                        remote_client.execute_command(cmd)
                rest.set_data_path(data_path=server.data_path,
                                       index_path=server.index_path)
                time.sleep(3)

                # Initialize cluster
                rest.init_cluster(username=server.rest_username,
                                  password=server.rest_password)
                memory_quota = rest.get_nodes_self().mcdMemoryReserved
                rest.init_cluster_memoryQuota(memoryQuota=memory_quota)

                # TODO: Symlink data-dir to custom path
                # remote_client.stop_couchbase()
                # remote_client.execute_command('mv /opt/couchbase/var {0}'.format(server.data_path))
                # remote_client.execute_command('ln -s {0}/var /opt/couchbase/var'.format(server.data_path))
                # remote_client.execute_command("chown -h couchbase:couchbase /opt/couchbase/var")
                # remote_client.start_couchbase()

                # Optionally disable consistency check
                if params.get('disable_consistency', 0):
                    rest.set_couchdb_option(section='couchdb',
                                            option='consistency_check_ratio',
                                            value='0.0')

                # memcached env variable
                mem_req_tap_env = params.get('MEMCACHED_REQS_TAP_EVENT', 0)
                if mem_req_tap_env:
                    remote_client.set_environment_variable('MEMCACHED_REQS_TAP_EVENT',
                                                           mem_req_tap_env)
                remote_client.disconnect()
                # TODO: Make it work with windows
                if "erlang_threads" in params:
                    num_threads = params.get('erlang_threads', testconstants.NUM_ERLANG_THREADS)
                    # Stop couchbase-server
                    ClusterOperationHelper.stop_cluster([server])
                    if "sync_threads" in params or ':' in num_threads:
                        sync_threads = params.get('sync_threads', True)
                    else:
                        sync_threads = False
                    # Change type of threads(sync/async) and num erlang threads
                    ClusterOperationHelper.change_erlang_threads_values([server], sync_threads, num_threads)
                    # Start couchbase-server
                    ClusterOperationHelper.start_cluster([server])
                if "erlang_gc_level" in params:
                    erlang_gc_level = params.get('erlang_gc_level', None)
                    if erlang_gc_level is None:
                        # Don't change the value
                        break
                    # Stop couchbase-server
                    ClusterOperationHelper.stop_cluster([server])
                    # Change num erlang threads
                    ClusterOperationHelper.change_erlang_gc([server], erlang_gc_level)
                    # Start couchbase-server
                    ClusterOperationHelper.start_cluster([server])
                cluster_initialized = True
                break
            except ServerUnavailableException:
                log.error("error happened while initializing the cluster @ {0}".format(server.ip))
            log.info('sleep for 5 seconds before trying again ...')
            time.sleep(5)
        if not cluster_initialized:
            raise Exception("unable to initialize couchbase node")
开发者ID:saigon,项目名称:testrunner,代码行数:84,代码来源:install.py

示例4: initialize

# 需要导入模块: from membase.helper.cluster_helper import ClusterOperationHelper [as 别名]
# 或者: from membase.helper.cluster_helper.ClusterOperationHelper import stop_cluster [as 别名]

#.........这里部分代码省略.........
                    info = rest.get_nodes_self()
                    cb_version = info.version[:5]

                    if cb_version in COUCHBASE_FROM_VERSION_4:
                        if "index" in set_services and "fts" not in set_services:
                            log.info("quota for index service will be %s MB" \
                                                              % (INDEX_QUOTA))
                            kv_quota = int(info.mcdMemoryReserved * 2/3) - INDEX_QUOTA
                            log.info("set index quota to node %s " % server.ip)
                            rest.set_indexer_memoryQuota(indexMemoryQuota=INDEX_QUOTA)
                            if kv_quota < MIN_KV_QUOTA:
                                raise Exception("KV RAM needs to be more than %s MB"
                                        " at node  %s"  % (MIN_KV_QUOTA, server.ip))
                        elif "index" in set_services and "fts" in set_services:
                            log.info("quota for index service will be %s MB" \
                                                              % (INDEX_QUOTA))
                            log.info("quota for fts service will be %s MB" \
                                                                % (FTS_QUOTA))
                            kv_quota = int(info.mcdMemoryReserved * 2/3)\
                                                                 - INDEX_QUOTA \
                                                                 - FTS_QUOTA
                            log.info("set both index and fts quota at node %s "\
                                                                    % server.ip)
                            rest.set_indexer_memoryQuota(indexMemoryQuota=INDEX_QUOTA)
                            rest.set_fts_memoryQuota(ftsMemoryQuota=FTS_QUOTA)
                            if kv_quota < MIN_KV_QUOTA:
                                raise Exception("KV RAM need to be more than %s MB"
                                       " at node  %s"  % (MIN_KV_QUOTA, server.ip))
                        elif "fts" in set_services and "index" not in set_services:
                            log.info("quota for fts service will be %s MB" \
                                                                % (FTS_QUOTA))
                            kv_quota = int(info.mcdMemoryReserved * 2/3) - FTS_QUOTA
                            if kv_quota < MIN_KV_QUOTA:
                                raise Exception("KV RAM need to be more than %s MB"
                                       " at node  %s"  % (MIN_KV_QUOTA, server.ip))
                            """ for fts, we need to grep quota from ns_server
                                but need to make it works even RAM of vm is
                                smaller than 2 GB """
                            rest.set_fts_memoryQuota(ftsMemoryQuota=FTS_QUOTA)
                    """ set kv quota smaller than 1 MB so that it will satify
                        the condition smaller than allow quota """
                    kv_quota -= 1
                    log.info("quota for kv: %s MB" % kv_quota)
                    rest.init_cluster_memoryQuota(server.rest_username, \
                                                       server.rest_password, \
                                                                     kv_quota)
                    if params["version"][:5] in COUCHBASE_FROM_VERSION_4:
                        rest.init_node_services(username=server.rest_username,
                                                password=server.rest_password,
                                                        services=set_services)
                    rest.init_cluster(username=server.rest_username,
                                         password=server.rest_password)

                # Optionally disable consistency check
                if params.get('disable_consistency', 0):
                    rest.set_couchdb_option(section='couchdb',
                                            option='consistency_check_ratio',
                                            value='0.0')

                # memcached env variable
                mem_req_tap_env = params.get('MEMCACHED_REQS_TAP_EVENT', 0)
                if mem_req_tap_env:
                    remote_client.set_environment_variable('MEMCACHED_REQS_TAP_EVENT',
                                                           mem_req_tap_env)
                """ set cbauth environment variables from Watson version
                    it is checked version inside method """
                remote_client.set_cbauth_env(server)
                remote_client.disconnect()
                # TODO: Make it work with windows
                if "erlang_threads" in params:
                    num_threads = params.get('erlang_threads', testconstants.NUM_ERLANG_THREADS)
                    # Stop couchbase-server
                    ClusterOperationHelper.stop_cluster([server])
                    if "sync_threads" in params or ':' in num_threads:
                        sync_threads = params.get('sync_threads', True)
                    else:
                        sync_threads = False
                    # Change type of threads(sync/async) and num erlang threads
                    ClusterOperationHelper.change_erlang_threads_values([server], sync_threads, num_threads)
                    # Start couchbase-server
                    ClusterOperationHelper.start_cluster([server])
                if "erlang_gc_level" in params:
                    erlang_gc_level = params.get('erlang_gc_level', None)
                    if erlang_gc_level is None:
                        # Don't change the value
                        break
                    # Stop couchbase-server
                    ClusterOperationHelper.stop_cluster([server])
                    # Change num erlang threads
                    ClusterOperationHelper.change_erlang_gc([server], erlang_gc_level)
                    # Start couchbase-server
                    ClusterOperationHelper.start_cluster([server])
                cluster_initialized = True
                break
            except ServerUnavailableException:
                log.error("error happened while initializing the cluster @ {0}".format(server.ip))
            log.info('sleep for 5 seconds before trying again ...')
            time.sleep(5)
        if not cluster_initialized:
            sys.exit("unable to initialize couchbase node")
开发者ID:EricACooper,项目名称:testrunner,代码行数:104,代码来源:install.py


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