Cross Data Center Replication (XDCR)

Cross Data Center Replication (XDCR) allows you to replicate data from one cluster to another.

Cross Data Center Replication (XDCR) replicates data between clusters. XDCR can provide protection against data-center failure, and also provide high performance access to data for globally distributed, mission critical applications.

XDCR replicates data from a specific bucket on a source cluster to a specific bucket on a target cluster. Data from the source bucket is pushed to the target bucket by means of an XDCR agent, running on the source cluster, using the Database Change Protocol. Any bucket on any cluster can be specified as a source or a target for one or more XDCR replications.

What XDCR Supports

XDCR only replicates bucket data; it does not replicate indexes. You’ll need to reproduce indexes manually.

When encountered on the source cluster, non-UTF-8 encoded document IDs are automatically filtered out of replication: they are therefore not transferred to the target cluster. For each such ID, the warning output xdcr_error.* is written to the log files of the source cluster

XDCR Direction

XDCR can occur between source and target clusters in either of the following ways:

Unidirectional

The data contained in a specified source bucket is replicated to a specified target bucket. Although the replicated data on the source could be used for the routine serving of data, it is in fact intended principally as a backup, to support disaster recovery.

Bidirectional

The data contained in a specified source bucket is replicated to a specified target bucket; and the data contained in the target bucket is, in turn, replicated back to the source bucket. This allows both buckets to be used for the serving of data, which may provide faster data-access for users and applications in remote geographies.

Technically, XDCR only performs unidirectional replication. A bidirectional topology is created by implementing two unidirectional replications, in opposite directions, between two clusters; such that a bucket on each cluster functions as both source and target.

Read more about XDCR Direction and Topology.

XDCR Filtering

Filtering Expressions can be used in XDCR replications. Each is a regular expression that is applied to the document keys on the source cluster: those document keys returned by the filtering process correspond to the documents that will be replicated to the target.

When a replication starts, it examines the specified source bucket, and determines which documents to replicate:

  • If XDCR Advanced Filtering is not applied, each document in the source bucket is replicated to the target.

  • If XDCR Advanced Filtering is applied, each document in the source bucket is examined; but only those documents that meet the specified filtering-criteria are replicated.

Read more about XDCR Advanced Filtering.

Conflict Resolution

In some cases, especially when bidirectionally replicated data is being modified by applications in different locations, conflicts may arise: meaning that the data of one or more documents has been differently modified more or less simultaneously, requiring resolution.

Couchbase Cloud uses timestamp-based conflict resolution. Timestamp-based conflict resolution uses the document timestamp (stored in the CAS) to resolve conflicts.