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


Python RestConnection.set_auto_compaction方法代码示例

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


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

示例1: PerfBase

# 需要导入模块: from lib.membase.api.rest_client import RestConnection [as 别名]
# 或者: from lib.membase.api.rest_client.RestConnection import set_auto_compaction [as 别名]

#.........这里部分代码省略.........
        for server in self.input.servers:
            shell = RemoteMachineShellConnection(server)
            cmd = "/opt/couchbase/bin/cbepctl localhost:11210 "\
                  "set flush_param db_frag_threshold {0}".format(comp_ratio)
            self._exec_and_log(shell, cmd)
            shell.disconnect()

    def set_autocompaction(self, disable_view_compaction=False):
        """Set custom auto-compaction settings"""

        try:
            # Parallel database and view compaction
            parallel_compaction = self.param("parallel_compaction",
                                             PerfDefaults.parallel_compaction)
            # Database fragmentation threshold
            db_compaction = self.parami("db_compaction",
                                        PerfDefaults.db_compaction)
            self.log.info("database compaction = {0}".format(db_compaction))

            # ep_engine fragementation threshold
            ep_compaction = self.parami("ep_compaction",
                                        PerfDefaults.ep_compaction)
            if ep_compaction != PerfDefaults.ep_compaction:
                self.set_ep_compaction(ep_compaction)
                self.log.info("ep_engine compaction = {0}".format(ep_compaction))

            # View fragmentation threshold
            if disable_view_compaction:
                view_compaction = 100
            else:
                view_compaction = self.parami("view_compaction",
                                              PerfDefaults.view_compaction)
            # Set custom auto-compaction settings
            self.rest.set_auto_compaction(parallelDBAndVC=parallel_compaction,
                                          dbFragmentThresholdPercentage=db_compaction,
                                          viewFragmntThresholdPercentage=view_compaction)
        except Exception as e:
            # It's very hard to determine what exception it can raise.
            # Therefore we have to use general handler.
            self.log.error("Error while changing compaction settings: {0}"
                           .format(e))

    def set_ep_param(self, type, param, value):
        """
        Set ep-engine specific param, using cbepctl

        type: paramter type, e.g: flush_param, tap_param, etc
        """
        bucket = Bucket(name=self.buckets[0], authType="sasl", saslPassword="")
        for server in self.input.servers:
            shell = RemoteMachineShellConnection(server)
            shell.execute_cbepctl(bucket,
                                  "", "set %s" % type, param, value)
            shell.disconnect()

    def tearDown(self):
        if self.parami("tear_down", 0) == 1:
            self.log.info("routine skipped")
            return

        self.log.info("routine starts")

        if self.parami("tear_down_proxy", 1) == 1:
            self.tear_down_proxy()
        else:
            self.log.info("proxy tearDown skipped")
开发者ID:,项目名称:,代码行数:70,代码来源:

示例2: set_auto_compaction

# 需要导入模块: from lib.membase.api.rest_client import RestConnection [as 别名]
# 或者: from lib.membase.api.rest_client.RestConnection import set_auto_compaction [as 别名]
 def set_auto_compaction(server, parallel_compaction, percent_threshold):
     rest = RestConnection(server)
     rest.set_auto_compaction(parallel_compaction,
                              dbFragmentThresholdPercentage=percent_threshold,
                              viewFragmntThresholdPercentage=percent_threshold)
开发者ID:,项目名称:,代码行数:7,代码来源:

示例3: test_view_rebalance

# 需要导入模块: from lib.membase.api.rest_client import RestConnection [as 别名]
# 或者: from lib.membase.api.rest_client.RestConnection import set_auto_compaction [as 别名]
    def test_view_rebalance(self):
        """Alk's specification.

        Cluster setup:
        -- 4 nodes
        -- 1 bucket
        -- 8GB total RAM
        -- 5GB bucket quota
        -- no data replica
        -- no index replica
        -- no view compaction

        All phases are enabled by default.
        Load phase:
        -- 10M items x 2KB average values size
        -- no expiration
        Index phase:
        -- 1 design ddoc, 1 view
        Access phase:
        -- no front-end workload
        -- rebalance out, from 4 to 3 nodes
        -- stale=false query after rebalance
        """
        # Legacy
        self.spec(self.__str__().split(" ")[0])

        # Disable stats
        self.input.test_params['stats'] = 0

        # View compaction setup
        rc = RestConnection(self.input.servers[0])
        vt = 30 if self.parami('view_compaction', 1) else 100
        rc.set_auto_compaction(dbFragmentThresholdPercentage=30,
                               viewFragmntThresholdPercentage=vt)

        # Consistent view setup
        if self.parami('consistent_view', 1):
            rc.set_reb_cons_view(disable=False)
        else:
            rc.set_reb_cons_view(disable=True)

        # rebalance_moves_per_second setup
        rmps = self.parami('rebalance_moves_per_second', 1)
        cmd = 'ns_config:set(rebalance_moves_per_node, {0}).'.format(rmps)
        rc.diag_eval(cmd)

        # index_pausing_disabled setup
        ipd = str(bool(self.parami('index_pausing_disabled', 0))).lower()
        cmd = 'ns_config:set(index_pausing_disabled, {0}).'.format(ipd)
        rc.diag_eval(cmd)

        # rebalance_index_waiting_disabled setup
        riwd = str(bool(self.parami('rebalance_index_waiting_disabled', 0))).lower()
        cmd = 'ns_config:set(rebalance_index_waiting_disabled, {0}).'.format(riwd)
        rc.diag_eval(cmd)

        # Customize number of design docs
        view_gen = ViewGen()
        if self.parami('ddocs', 1) == 1:
            ddocs = view_gen.generate_ddocs([1])
        elif self.parami('ddocs', 1) == 8:
            ddocs = view_gen.generate_ddocs([1, 1, 1, 1, 1, 1, 1, 1])
        else:
            sys.exit('Only 1 or 8 ddocs supported.')

        # Load phase
        if self.parami('load_phase', 1):
            num_nodes = self.parami('num_nodes', PerfDefaults.num_nodes)
            self.load_phase(num_nodes)

        # Index phase
        if self.parami('index_phase', 1):
            self.index_phase(ddocs)

        # Access phase
        if self.parami('access_phase', 1):
            if self.param('rebalance', 'out') == 'out':
                RebalanceHelper.rebalance_out(servers=self.input.servers,
                                              how_many=1, monitor=True)
            elif self.param('rebalance', 'out') == 'swap':
                RebalanceHelper.rebalance_swap(servers=self.input.servers,
                                               how_many=1, monitor=True)
            else:
                sys.exit('Only rebalance-out and swap rebalance supported.')
            self.measure_indexing_time(rc, ddocs)
开发者ID:mschoch,项目名称:testrunner,代码行数:87,代码来源:iperf.py


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