本文整理汇总了Python中lib.membase.api.rest_client.RestConnection.set_reb_cons_view方法的典型用法代码示例。如果您正苦于以下问题:Python RestConnection.set_reb_cons_view方法的具体用法?Python RestConnection.set_reb_cons_view怎么用?Python RestConnection.set_reb_cons_view使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.membase.api.rest_client.RestConnection
的用法示例。
在下文中一共展示了RestConnection.set_reb_cons_view方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_view_rebalance
# 需要导入模块: from lib.membase.api.rest_client import RestConnection [as 别名]
# 或者: from lib.membase.api.rest_client.RestConnection import set_reb_cons_view [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)