本文整理汇总了Python中lib.membase.api.rest_client.RestConnection.monitorRebalance方法的典型用法代码示例。如果您正苦于以下问题:Python RestConnection.monitorRebalance方法的具体用法?Python RestConnection.monitorRebalance怎么用?Python RestConnection.monitorRebalance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.membase.api.rest_client.RestConnection
的用法示例。
在下文中一共展示了RestConnection.monitorRebalance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CBASBaseTest
# 需要导入模块: from lib.membase.api.rest_client import RestConnection [as 别名]
# 或者: from lib.membase.api.rest_client.RestConnection import monitorRebalance [as 别名]
#.........这里部分代码省略.........
default_params=self._create_bucket_params(server=self.master, size=self.bucket_size,
replicas=self.num_replicas, bucket_type=self.bucket_type,
enable_replica_index=self.enable_replica_index,
eviction_policy=self.eviction_policy, lww=self.lww)
self.cluster.create_default_bucket(default_params)
self.buckets.append(Bucket(name="default", authType="sasl", saslPassword="",
num_replicas=self.num_replicas, bucket_size=self.bucket_size,
eviction_policy=self.eviction_policy, lww=self.lww,
type=self.bucket_type))
if self.enable_time_sync:
self._set_time_sync_on_buckets( ['default'] )
def add_all_cbas_node_then_rebalance(self):
if len(self.cbas_servers)>=1:
for server in self.cbas_servers:
'''This is the case when master node is running cbas service as well'''
if self.master.ip != server.ip:
self.otpNodes.append(self.rest.add_node(user=server.rest_username,
password=server.rest_password,
remoteIp=server.ip,
port=8091,
services=server.services.split(",")))
self.rebalance()
else:
self.log.info("No CBAS server to add in cluster")
return self.otpNodes
def rebalance(self, wait_for_completion=True):
nodes = self.rest.node_statuses()
started = self.rest.rebalance(otpNodes=[node.id for node in nodes])
if started and wait_for_completion:
result = self.rest.monitorRebalance()
self.assertTrue(result, "Rebalance operation failed after adding %s cbas nodes,"%self.cbas_servers)
self.log.info("successfully rebalanced cluster {0}".format(result))
else:
self.assertTrue(started, "Rebalance operation started and in progress,"%self.cbas_servers)
def remove_all_cbas_node_then_rebalance(self,cbas_otpnodes=None, rebalance=True ):
return self.remove_node(cbas_otpnodes,rebalance)
def add_node(self, node=None, services=None, rebalance=True, wait_for_rebalance_completion=True):
if not node:
self.fail("There is no node to add to cluster.")
if not services:
services = node.services.split(",")
otpnode = self.rest.add_node(user=node.rest_username,
password=node.rest_password,
remoteIp=node.ip,
port=8091,
services=services
)
if rebalance:
self.rebalance(wait_for_completion=wait_for_rebalance_completion)
return otpnode
def remove_node(self,otpnode=None, wait_for_rebalance=True):
nodes = self.rest.node_statuses()
'''This is the case when master node is running cbas service as well'''
if len(nodes) <= len(otpnode):
return
helper = RestHelper(self.rest)
try:
removed = helper.remove_nodes(knownNodes=[node.id for node in nodes],