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


Python RestConnection.start_replication方法代码示例

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


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

示例1: start_replication

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import start_replication [as 别名]
    def start_replication(self, master, slave, replication_type='continuous',
                          buckets=None, bidir=False, suffix='A'):
        """Add remote cluster and start replication"""

        master_rest_conn = RestConnection(master)
        remote_reference = 'remote_cluster_' + suffix

        master_rest_conn.add_remote_cluster(slave.ip, slave.port,
                                            slave.rest_username,
                                            slave.rest_password,
                                            remote_reference)

        if not buckets:
            buckets = self.get_buckets()
        else:
            buckets = self.get_buckets(reversed=True)

        for bucket in buckets:
            master_rest_conn.start_replication(replication_type, bucket,
                                               remote_reference)

        if self.parami('num_buckets', 1) > 1 and suffix == 'A':
            self.start_replication(slave, master, replication_type, buckets,
                                   suffix='B')

        if bidir:
            self.start_replication(slave, master, replication_type, buckets,
                                   suffix='B')
开发者ID:jchris,项目名称:testrunner,代码行数:30,代码来源:xperf.py

示例2: cluster_bucket_xdcr_write

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import start_replication [as 别名]
    def cluster_bucket_xdcr_write(self,username,password,host,port=8091,servers=None,cluster=None,httpCode=None,user_role=None):
        _cluster_xdcr_settings_read = {
            "create_replication":"controller/createReplication;POST",
            "cancel_XDCR":"controller/cancelXDCR/<xid>;POST",
            "delete_XDCR":"controller/cancelXDCR/<xid>;DELETE"
        }

        rest = RestConnection(servers[0])
        rest.remove_all_replications()
        rest.remove_all_remote_clusters()

        remote_cluster_name = 'rbac_cluster'
        rest = RestConnection(servers[0])
        remote_server01 = servers[1]
        remote_server02 = servers[2]
        rest_remote01 = RestConnection(remote_server01)
        rest_remote01.delete_bucket()
        rest_remote01.create_bucket(bucket='default1', ramQuotaMB=100,proxyPort=11252)
        rest_remote02 = RestConnection(remote_server02)
        remote_id = rest.add_remote_cluster(remote_server01.ip,8091,'Administrator','password',remote_cluster_name)
        time.sleep(10)
        #replication_id = rest.start_replication('continuous','default',remote_cluster_name)

        param_map = {'replicationType': 'continuous','toBucket': 'default1','fromBucket': 'default','toCluster': remote_cluster_name,
                     'type': 'capi'}
        create_replication = {"create_replication":"controller/createReplication;POST;"+str(param_map)}
        result = self._return_http_code(create_replication,username,password,host=host,port=port, httpCode=httpCode, user_role=user_role)


        rest.remove_all_replications()
        rest.remove_all_remote_clusters()

        remote_id = rest.add_remote_cluster(remote_server01.ip,8091,'Administrator','password',remote_cluster_name)
        time.sleep(20)
        replication_id = rest.start_replication('continuous',fromBucket='default',toCluster=remote_cluster_name,toBucket='default1')
        replication_id = replication_id.replace("/","%2F")

        cancel_replication = {"cancel_XDCR":"controller/cancelXDCR/" + replication_id + ";POST"}
        result = self._return_http_code(cancel_replication,username,password,host=host,port=port, httpCode=httpCode, user_role=user_role)

        rest.remove_all_replications()
        rest.remove_all_remote_clusters()
        remote_id = rest.add_remote_cluster(remote_server01.ip,8091,'Administrator','password',remote_cluster_name)
        time.sleep(20)
        replication_id = rest.start_replication('continuous',fromBucket='default',toCluster=remote_cluster_name,toBucket='default1')
        replication_id = replication_id.replace("/","%2F")

        cancel_replication = {"cancel_XDCR":"controller/cancelXDCR/" + replication_id + ";DELETE"}
        result = self._return_http_code(cancel_replication,username,password,host=host,port=port, httpCode=httpCode, user_role=user_role)

        rest.remove_all_replications()
        rest.remove_all_remote_clusters()
        rest_remote01.delete_bucket('default1')
开发者ID:mihirkamdarcouchbase,项目名称:testrunner,代码行数:55,代码来源:rbacPermissionList.py

示例3: cluster_xdcr_remote_clusters_read

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import start_replication [as 别名]
    def cluster_xdcr_remote_clusters_read(self,username,password,host,port=8091, servers=None,cluster=None,httpCode=None,user_role=None):
        remote_cluster_name = 'rbac_cluster'
        rest = RestConnection(servers[0])
        remote_server01 = servers[1]
        remote_server02 = servers[2]
        rest_remote01 = RestConnection(remote_server01)
        rest_remote01.delete_bucket()
        rest_remote01.create_bucket(bucket='default', ramQuotaMB=100)
        rest_remote02 = RestConnection(remote_server02)

        #------ First Test the Get Requests for XDCR --------------#

        #Remove all remote cluster references
        rest.remove_all_replications()
        rest.remove_all_remote_clusters()

        #Add remote cluster reference and replications
        rest.add_remote_cluster(remote_server01.ip,8091,'Administrator','password',remote_cluster_name)
        time.sleep(20)
        replication_id = rest.start_replication('continuous','default',remote_cluster_name)

        _cluster_xdcr_remote_clusters_read ={
            "remove_cluser_read":"/pools/default/remoteClusters;GET",
        }

        result = self._return_http_code(_cluster_xdcr_remote_clusters_read,username,password,host=host,port=8091, httpCode=httpCode, user_role=user_role)
开发者ID:mihirkamdarcouchbase,项目名称:testrunner,代码行数:28,代码来源:rbacPermissionList.py

示例4: cluster_bucket_xdcr_read

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import start_replication [as 别名]
    def cluster_bucket_xdcr_read(self,username,password,host,port=8091,servers=None,cluster=None,httpCode=None,user_role=None):
        _cluster_bucket_xdcr_read = {
            "replication_settings":"settings/replications/<id>;GET"
        }

        rest = RestConnection(servers[0])
        rest.remove_all_replications()
        rest.remove_all_remote_clusters()

        remote_cluster_name = 'rbac_cluster'
        rest = RestConnection(servers[0])
        remote_server01 = servers[1]
        remote_server02 = servers[2]
        rest_remote01 = RestConnection(remote_server01)
        rest_remote01.delete_bucket()
        rest_remote01.create_bucket(bucket='default', ramQuotaMB=100)
        rest_remote02 = RestConnection(remote_server02)
        remote_id = rest.add_remote_cluster(remote_server01.ip,8091,'Administrator','password',remote_cluster_name)
        replication_id = rest.start_replication('continuous','default',remote_cluster_name)
        replication_id = replication_id.replace("/","%2F")

        bucket_xdcr_read = {"replication_settings":"settings/replications/" + replication_id + ";GET"}
        result = self._return_http_code(bucket_xdcr_read,username,password,host=host,port=port, httpCode=httpCode, user_role=user_role)

        rest.remove_all_replications()
        rest.remove_all_remote_clusters()
        rest_remote01.delete_bucket()
开发者ID:chethanrao,项目名称:testrunner-archive,代码行数:29,代码来源:rbacPermissionList.py

示例5: cluster_xdcr_settings_write

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import start_replication [as 别名]
    def cluster_xdcr_settings_write(self,username,password,host,port=8091,servers=None,cluster=None,httpCode=None,user_role=None):

        _cluster_xdcr_settings_read = {
            "replication_settings":"settings/replications;POST;{'httpConnections': 20}"
        }

        rest = RestConnection(servers[0])
        rest.remove_all_replications()
        rest.remove_all_remote_clusters()

        remote_cluster_name = 'rbac_cluster'
        rest = RestConnection(servers[0])
        remote_server01 = servers[1]
        remote_server02 = servers[2]
        rest_remote01 = RestConnection(remote_server01)
        rest_remote01.delete_bucket()
        rest_remote01.create_bucket(bucket='default', ramQuotaMB=100)
        rest_remote02 = RestConnection(remote_server02)
        rest_remote02.delete_bucket()
        remote_id = rest.add_remote_cluster(remote_server01.ip,8091,'Administrator','password',remote_cluster_name)
        time.sleep(20)
        replication_id = rest.start_replication('continuous','default',remote_cluster_name)

        result = self._return_http_code(_cluster_xdcr_settings_read,username,password,host=host,port=port, httpCode=httpCode, user_role=user_role)

        rest.remove_all_replications()
        rest.remove_all_remote_clusters()
        rest_remote01.delete_bucket()
开发者ID:mihirkamdarcouchbase,项目名称:testrunner,代码行数:30,代码来源:rbacPermissionList.py

示例6: xdcr_start_replication

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import start_replication [as 别名]
def xdcr_start_replication(src_master, dest_cluster_name, bucketFilter = None):
        rest_conn_src = RestConnection(src_master)
        for bucket in rest_conn_src.get_buckets():
            if bucketFilter is None or bucket.name in bucketFilter:
                rep_id = rest_conn_src.start_replication("continuous",
                                                                         bucket.name, dest_cluster_name)
                logger.error("rep_id: %s" %rep_id)
开发者ID:lichia,项目名称:testrunner,代码行数:9,代码来源:rest_client_tasks.py

示例7: _XDCR_role_test

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import start_replication [as 别名]
    def _XDCR_role_test(self):
        params = {}
        remote_cluster_name = 'rbac_cluster'
        remote_server01 = self.servers[1]
        remote_server02 = self.servers[2]
        read_role = '_replication_admin_read'
        write_role = '_replication_admin_write'
        rest_remote01 = RestConnection(remote_server01)
        rest_remote01.create_bucket(bucket='default', ramQuotaMB=100)
        rest_remote02 = RestConnection(remote_server02)
        rest_remote02.create_bucket(bucket='default', ramQuotaMB=100)

        #------ First Test the Get Requests for XDCR --------------#

        #Remove all remote cluster references
        self.rest.remove_all_replications()
        self.rest.remove_all_remote_clusters()

        #Add remote cluster reference and replications
        self.rest.add_remote_cluster(remote_server01.ip,8091,'Administrator','password',remote_cluster_name)
        replication_id = self.rest.start_replication('continuous','default',remote_cluster_name)
        masDict,tc_status = self.rbac._iterate_role_mapping(read_role,"Administrator","password",{'replication_id':replication_id})

        self.rest.remove_all_replications()
        self.rest.remove_all_remote_clusters()
        rest_remote01.remove_all_replications()
        rest_remote01.remove_all_remote_clusters()
        rest_remote02.remove_all_replications()
        rest_remote02.remove_all_remote_clusters()


        # ----------- Second Test for POST requests for XDCR ---------------#

        self.rest.remove_all_replications()
        self.rest.remove_all_remote_clusters()
        rest_remote01.remove_all_replications()
        rest_remote01.remove_all_remote_clusters()
        rest_remote02.remove_all_replications()
        rest_remote02.remove_all_remote_clusters()


        self.rest.add_remote_cluster(remote_server01.ip,8091,'Administrator','password',"onetotwo")
        #self.rest.add_remote_cluster(remote_server02.ip,8091,'Administrator','password','onetothree')
        #rest_remote01.add_remote_cluster(remote_server02.ip,8091,'Administrator','password',"twotothree")
        rest_remote01.add_remote_cluster(self.master.ip,8091,'Administrator','password','twotoone')
        rest_remote02.add_remote_cluster(remote_server01.ip,8091,'Administrator','password',"threetotwo")
        rest_remote02.add_remote_cluster(self.master.ip,8091,'Administrator','password','threetoone')

        params['remote_cluster_name']='onetotwo'
        params['remoteCluster01'] = {'username': 'Administrator', 'password': 'password', 'hostname': '192.168.46.103:8091', 'name': 'onetothree'}

        params['create_replication'] = {'replicationType': 'continuous','toBucket': 'default','fromBucket': 'default','toCluster': 'twotoone','type': 'xmem'}
        params['replication_id'] = rest_remote01.start_replication('continuous','default','twotoone')



        masDict,tc_status = self.rbac._iterate_role_mapping('_replication_admin_write01',"Administrator","password",params)
        masDict,tc_status = self.rbac._iterate_role_mapping('_replication_admin_write02',"Administrator","password",params,self.servers[1])

        '''
开发者ID:ritamcouchbase,项目名称:misctests,代码行数:62,代码来源:rbacTest.py

示例8: test_basic_xdcr_with_cert_regenerate

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import start_replication [as 别名]
    def test_basic_xdcr_with_cert_regenerate(self):

        cluster1 = self.servers[0:2]
        cluster2 = self.servers[2:4]
        remote_cluster_name = 'sslcluster'
        restCluster1 = RestConnection(cluster1[0])
        restCluster2 = RestConnection(cluster2[0])

        try:
            #Setup cluster1
            x509main(cluster1[0]).setup_master()
            x509main(cluster1[1])._setup_node_certificates(reload_cert=False)

            restCluster1.add_node('Administrator','password',cluster1[1].ip)
            known_nodes = ['[email protected]'+cluster1[0].ip,'[email protected]' + cluster1[1].ip]
            restCluster1.rebalance(known_nodes)
            self.assertTrue(self.check_rebalance_complete(restCluster1),"Issue with rebalance")
            restCluster1.create_bucket(bucket='default', ramQuotaMB=100)
            restCluster1.remove_all_replications()
            restCluster1.remove_all_remote_clusters()

            #Setup cluster2
            x509main(cluster2[0]).setup_master()
            x509main(cluster2[1])._setup_node_certificates(reload_cert=False)

            restCluster2.add_node('Administrator','password',cluster2[1].ip)
            known_nodes = ['[email protected]'+cluster2[0].ip,'[email protected]' + cluster2[1].ip]
            restCluster2.rebalance(known_nodes)
            self.assertTrue(self.check_rebalance_complete(restCluster2),"Issue with rebalance")
            restCluster2.create_bucket(bucket='default', ramQuotaMB=100)

            test = x509main.CACERTFILEPATH + x509main.CACERTFILE
            data  =  open(test, 'rb').read()
            restCluster1.add_remote_cluster(cluster2[0].ip,cluster2[0].port,'Administrator','password',remote_cluster_name,certificate=data)
            replication_id = restCluster1.start_replication('continuous','default',remote_cluster_name)

            #restCluster1.set_xdcr_param('default','default','pauseRequested',True)

            x509main(self.master)._delete_inbox_folder()
            x509main(self.master)._generate_cert(self.servers,root_cn="CB\ Authority")
            self.log.info ("Setting up the first cluster for new certificate")

            x509main(cluster1[0]).setup_master()
            x509main(cluster1[1])._setup_node_certificates(reload_cert=False)
            self.log.info ("Setting up the second cluster for new certificate")
            x509main(cluster2[0]).setup_master()
            x509main(cluster2[1])._setup_node_certificates(reload_cert=False)

            status = restCluster1.is_replication_paused('default','default')
            if not status:
                restCluster1.set_xdcr_param('default','default','pauseRequested',False)

            restCluster1.set_xdcr_param('default','default','pauseRequested',True)
            status = restCluster1.is_replication_paused('default','default')
            self.assertTrue(status,"Replication has not started after certificate upgrade")
        finally:
            known_nodes = ['[email protected]'+cluster2[0].ip,'[email protected]'+cluster2[1].ip]
            restCluster2.rebalance(known_nodes,['[email protected]' + cluster2[1].ip])
            self.assertTrue(self.check_rebalance_complete(restCluster2),"Issue with rebalance")
            restCluster2.delete_bucket()
开发者ID:EricACooper,项目名称:testrunner,代码行数:62,代码来源:x509tests.py

示例9: test_verify_mb15892

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import start_replication [as 别名]
    def test_verify_mb15892(self):
        """
        Test case for MB-15892

        Create replication should not allow setting-up replication to remote memcached bucket
        Make sure to set default_bucket to False as the test will create default buckets
        on source and destination masters
        """
        rest_conn_src = RestConnection(self.src_master)
        rest_conn_src.create_bucket(bucket='default', ramQuotaMB=256)
        master_id = rest_conn_src.get_nodes_self().id
        #if not cluster run use ip addresses instead of localhost
        if len(set([server.ip for server in self._servers])) != 1:
            master_id = master_id.replace("127.0.0.1", self.src_master.ip).replace("localhost", self.src_master.ip)
        self.buckets.append(Bucket(name="default", authType="sasl", saslPassword="",
                                       num_replicas=self._num_replicas, bucket_size=256, master_id=master_id,
                                       eviction_policy=self.eviction_policy))

        rest_conn_dest = RestConnection(self.dest_master)
        rest_conn_dest.create_bucket(bucket='default', ramQuotaMB=256, bucketType='memcached')
        master_id = rest_conn_dest.get_nodes_self().id
        #if not cluster run use ip addresses instead of localhost
        if len(set([server.ip for server in self._servers])) != 1:
            master_id = master_id.replace("127.0.0.1", self.dest_master.ip).replace("localhost", self.dest_master.ip)
        self.buckets.append(Bucket(name="default", authType="sasl", saslPassword="",
                                       num_replicas=self._num_replicas, bucket_size=256, master_id=master_id,
                                       eviction_policy=self.eviction_policy))

        remote_cluster_name = "C2"
        self._link_clusters(self.src_master, remote_cluster_name, self.dest_master)

        buckets = self._get_cluster_buckets(self.src_master)
        src_bucket = buckets[0]

        buckets = self._get_cluster_buckets(self.dest_master)
        dest_bucket = buckets[0]

        try:
            rest_conn_src.start_replication(XDCRConstants.REPLICATION_TYPE_CONTINUOUS,
                                        src_bucket.name, remote_cluster_name,
                                        self.rep_type, toBucket=dest_bucket.name)
        except Exception as e:
            expected_error = "Incompatible target bucket"
            self.assertTrue(expected_error in str(e), "Incompatible target bucket exception not raised as expected")
            self.log.info("Incompatible target bucket exception raised as expected")
开发者ID:EricACooper,项目名称:testrunner,代码行数:47,代码来源:xdcrMiscTests.py

示例10: _replicate_clusters

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import start_replication [as 别名]
 def _replicate_clusters(self, src_master, dest_cluster_name, buckets):
     rest_conn_src = RestConnection(src_master)
     for bucket in buckets:
         (rep_database, rep_id) = rest_conn_src.start_replication(XDCRConstants.REPLICATION_TYPE_CONTINUOUS,
             bucket, dest_cluster_name, self.rep_type)
         self._start_replication_time[bucket] = datetime.now()
         self.sleep(5)
     if self._get_cluster_buckets(src_master):
         self._cluster_state_arr.append((rest_conn_src, dest_cluster_name, rep_database, rep_id))
开发者ID:arunapiravi,项目名称:testrunner,代码行数:11,代码来源:upgradeXDCR.py

示例11: _link_create_replications

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import start_replication [as 别名]
 def _link_create_replications(self, master_1, master_2, cluster_name):
     rest = RestConnection(master_1)
     rest.add_remote_cluster(master_2.ip, master_2.port, master_1.rest_username,
                              master_1.rest_password, cluster_name)
     time.sleep(30)
     if len(self._buckets) == 0:
         self._buckets = rest.get_buckets()
     for bucket in set(self._buckets):
         rep_database, rep_id = rest.start_replication("continuous", bucket, cluster_name)
开发者ID:abhinavdangeti,项目名称:testrunner,代码行数:11,代码来源:cluster_setup.py

示例12: xdcr_start_replication

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import start_replication [as 别名]
def xdcr_start_replication(src_master, dest_cluster_name, bucket_name, xdcr_params):
    rest_conn_src = RestConnection(src_master)
    for bucket in rest_conn_src.get_buckets():
        if bucket.name == bucket_name:
            rep_id = rest_conn_src.start_replication("continuous",
                                                        bucket.name,
                                                        dest_cluster_name,
                                                        xdcr_params=xdcr_params)
            logger.error("rep_id: %s" %rep_id)
开发者ID:EricACooper,项目名称:testrunner,代码行数:11,代码来源:rest_client_tasks.py

示例13: test_continuous_unidirectional_deletes_2

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import start_replication [as 别名]
    def test_continuous_unidirectional_deletes_2(self):
        cluster_ref_a = "cluster_ref_a"
        master_a = self._input.clusters.get(0)[0]
        rest_conn_a = RestConnection(master_a)

        cluster_ref_b = "cluster_ref_b"
        master_b = self._input.clusters.get(1)[0]
        rest_conn_b = RestConnection(master_b)

        # Load some data on cluster a. Do it a few times so that the seqnos are
        # bumped up and then delete it.
        kvstore = ClientKeyValueStore()
        self._params["ops"] = "set"
        load_thread_list = []
        for i in [1, 2, 3]:
            task_def = RebalanceDataGenerator.create_loading_tasks(self._params)
            load_thread = RebalanceDataGenerator.start_load(rest_conn_a,
                                                            self._buckets[0],
                                                            task_def, kvstore)
            load_thread_list.append(load_thread)

        for lt in load_thread_list:
            lt.start()
        for lt in load_thread_list:
            lt.join()
        time.sleep(10)

        self._params["ops"] = "delete"
        task_def = RebalanceDataGenerator.create_loading_tasks(self._params)
        load_thread = RebalanceDataGenerator.start_load(rest_conn_a,
                                                        self._buckets[0],
                                                        task_def, kvstore)
        load_thread.start()
        load_thread.join()

        # Start replication to replicate the deletes from cluster a
        # to cluster b where the keys never existed.
        replication_type = "continuous"
        rest_conn_a.add_remote_cluster(master_b.ip, master_b.port,
                                       master_b.rest_username,
                                       master_b.rest_password, cluster_ref_b)
        (rep_database, rep_id) = rest_conn_a.start_replication(replication_type,
                                                               self._buckets[0],
                                                               cluster_ref_b)
        self._state.append((rest_conn_a, cluster_ref_b, rep_database, rep_id))

        time.sleep(15)

        # Verify replicated data#
        self.assertTrue(XDCRBaseTest.verify_del_items(rest_conn_a,
                                                      rest_conn_b,
                                                      self._buckets[0],
                                                      kvstore.keys(),
                                                      self._poll_sleep,
                                                      self._poll_timeout),
                        "Changes feed verification failed")
开发者ID:jchris,项目名称:testrunner,代码行数:58,代码来源:xdcr.py

示例14: test_xdcr_within_same_cluster

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import start_replication [as 别名]
    def test_xdcr_within_same_cluster(self):
        remote_cluster_name = "same-cluster"
        self._link_clusters(self.src_master, remote_cluster_name, self.src_master)

        buckets = self._get_cluster_buckets(self.src_master)
        self.assertTrue(len(buckets) >= 2, "Number of buckets required for this is greater than 1 on source cluster")
        src_bucket, dest_bucket = buckets[0], buckets[1]

        self._load_bucket(src_bucket, self.src_master, self.gen_create, "create", 0)

        # Step-4 XDCR Source -> Remote
        rest_conn_src = RestConnection(self.src_master)
        rest_conn_src.start_replication(XDCRConstants.REPLICATION_TYPE_CONTINUOUS,
                                        src_bucket.name, remote_cluster_name,
                                        self.rep_type, toBucket=dest_bucket.name)

        dest_bucket.kvs[1] = src_bucket.kvs[1]

        self._verify_item_count(self.src_master, self.src_nodes)
        self._verify_data_all_buckets(self.src_master)
开发者ID:DavidAlphaFox,项目名称:couchbase,代码行数:22,代码来源:xdcrMiscTests.py

示例15: test_continuous_unidirectional_sets_deletes

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import start_replication [as 别名]
    def test_continuous_unidirectional_sets_deletes(self):
        cluster_ref_b = "cluster_ref_a"
        master_a = self._input.clusters.get(0)[0]
        rest_conn_a = RestConnection(master_a)

        cluster_ref_b = "cluster_ref_b"
        master_b = self._input.clusters.get(1)[0]
        rest_conn_b = RestConnection(master_b)

        # Start replication
        replication_type = "continuous"
        rest_conn_a.add_remote_cluster(master_b.ip, master_b.port,
                                       master_b.rest_username,
                                       master_b.rest_password, cluster_ref_b)
        (rep_database, rep_id) = rest_conn_a.start_replication(replication_type,
                                                               self._buckets[0],
                                                               cluster_ref_b)
        self._state.append((rest_conn_a, cluster_ref_b, rep_database, rep_id))

        # Start load
        kvstore = ClientKeyValueStore()
        self._params["ops"] = "set"
        task_def = RebalanceDataGenerator.create_loading_tasks(self._params)
        load_thread = RebalanceDataGenerator.start_load(rest_conn_a,
                                                        self._buckets[0],
                                                        task_def, kvstore)
        load_thread.start()
        load_thread.join()

        # Do some deletes
        self._params["ops"] = "delete"
        self._params["count"] = self._num_items/5
        task_def = RebalanceDataGenerator.create_loading_tasks(self._params)
        load_thread = RebalanceDataGenerator.start_load(rest_conn_a,
                                                        self._buckets[0],
                                                        task_def, kvstore)
        load_thread.start()
        load_thread.join()

        # Verify replication
        self.assertTrue(XDCRBaseTest.verify_replicated_data(rest_conn_b,
                                                            self._buckets[0],
                                                            kvstore,
                                                            self._poll_sleep,
                                                            self._poll_timeout),
                        "Verification of replicated data failed")
        self.assertTrue(XDCRBaseTest.verify_replicated_revs(rest_conn_a,
                                                            rest_conn_b,
                                                            self._buckets[0],
                                                            self._poll_sleep,
                                                            self._poll_timeout),
                        "Verification of replicated revisions failed")
开发者ID:steveyen,项目名称:testrunner,代码行数:54,代码来源:xdcr.py


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