You configure replications using the XDCR tab of the Administration Web Console. You configure replication on a bucket basis. If you want to replicate data from all buckets in a cluster, you should individually configure replication for each bucket.
Before You Configure XDCR
All nodes within each cluster must be configured to communicate with all the nodes on the destination cluster. XDCR will use any node in a cluster to replicate between the two clusters.
Couchbase Server versions and platforms, must match. For instance if you want to replicate from a Linux-based cluster, you need to do so with another Linux-based cluster.
When XDCR performs replication, it exchanges data between clusters over TCP/IP port 8092; Couchbase Server uses TCP/IP port 8091 to exchange cluster configuration information. If you are communicating with a destination cluster over a dedicated connection or the Internet you should ensure that all the nodes in the destination and source clusters can communicate with each other over ports 8091 and 8092.
Ongoing Replications are those replications that are currently configured and operating. You can monitor the current configuration, current status, and the last time a replication process was triggered for each configured replication.
Under the XDCR tab you can also configure Remote Clusters for XDCR; these are named destination clusters you can select when you configure replication. When you configure XDCR, the destination cluster reference should point to the IP address of one of the nodes in the destination cluster.
Before you set up replication via XDCR, you should be certain that a destination bucket already exists. If this bucket does not exist, replication via XDCR may not find some shards on the destination cluster; this will result in replication of only some data from the source bucket and will significantly delay replication. This would also require you to retry replication multiple times to get a source bucket to be fully replicated to a destination.
Therefore make sure that you check that a destination bucket exists. The recommended approach is try to read on any key from the bucket. If you receive a 'key not found' error, or the document for the key, the bucket exists and is available to all nodes in a cluster. You can do this via a Couchbase SDK with any node in the cluster. See Couchbase Developer Guide 2.0, Performing Connect, Set and Get.
For more information about creating buckets via the REST API, see Section 8.6.5, “Creating and Editing Data Buckets”.
To create a uni-directional replication (i.e. from cluster A to cluster B):
Check and ensure that a destination bucket exists on the cluster to which you will be replicating. To do so, perform this REST API request:
curl -u Admin:password http://ip.for.destination.cluster:8091/pools/default/bucketsTo set up a destination cluster reference, click the button. You will be prompted to enter a name used to identify this cluster, the IP address, and optionally the administration port number for the remote cluster.
Enter the username and password for the administrator on the destination cluster.
Click Save to store new reference to the destination cluster. This cluster information will now be available when you configure replication for your source cluster.
Click to configure a new XDCR replication. A panel appears where you can configure a new replication from source to destination cluster.
In the Replicate changes from section
select a from the current cluster that is to be replicated.
This is your source bucket.
In the To section, select a destination
cluster and enter a bucket name from the destination
cluster:
Click the button to start the replication process.
After you have configured and started replication, the web console will show the current status and list of replications in the Ongoing Replications section:
Configuring Bi-Directional Replication
Replication is unidirectional from one cluster to another. To configure bidirectional replication between two clusters, you need to provide settings for two separate replication streams. One stream replicates changes from Cluster A to Cluster B, another stream replicates changes from Cluster B to Cluster A. To configure a bidirectional replication:
Create a replication from Cluster A to Cluster B on Cluster A.
Create a replication from Cluster B to Cluster A on Cluster B.
You do not need identical topologies for both clusters; you can have a different number of nodes in each cluster, and different RAM and persistence configurations.
You can also create a replication using the Administration REST API instead of Couchbase Web Console. For more information, see Section 8.9.1, “Getting a Destination Cluster Reference”.
After you create a replication between clusters, you can configure the number of parallel replicators that run per node. The default number of parallel, active streams per node is 32, but you can adjust this. For information on changing the internal configuration settings, see Section 8.9.6, “Viewing Internal XDCR Settings”.