A newer version of this documentation is available.

View Latest

Creating XDCR Replications

To create an XDCR replication, use the POST /controller/createReplication HTTP method and URI.


Data replication occurs from a source cluster to a destination cluster. Once a replication is created, data replication between clusters automatically begins.

HTTP method and URI

POST /controller/createReplication


Curl request syntax:

curl -v -X POST -u [admin]:[password]
  -d fromBucket=[bucket-name]
  -d toCluster=[cluster-name]
  -d toBucket=[bucket-name]
  -d replicationType=continuous
  -d type=[capi | xmem]
  -d compressionType=["None" | "Auto" | "Snappy"]
  -d filterExpression=[regular expression (optional)]

The type values, capi and xmem, are represented by version1 and version2 in the web console. Default: xmem. Because xmem is the default for Type, this parameter is not required when creating xmem replications. The replicationType value is always continuous.

A compressionType value of None specifies that data compression is not used during replication. A value of Snappy specifies that the open-source Snappy library is used, to provide data compression during replication. A value of Auto specifies that the latest Couchbase-provided form of data-compression is used. If compression is indeed required, specifying Auto is recommended; since this always refers to the best available compression technology.


The following example creates a replication between the source and remote buckets. The remote bucket is located on a cluster named Note that data compression is enabled, by specifying the value 1 (specifying 0 disables compression).

curl -v -X POST -u Administrator:password \ \
-d fromBucket=source \
-d toCluster= \
-d toBucket=remote \
-d replicationType=continuous \
-d compressionType="Snappy"

Raw HTTP request:

Authorization: Basic QWRtaW5pc3RyYXRvcjpwYXNzd29yZDE=
User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
Accept: */*
Content-Length: 126
Content-Type: application/x-www-form-urlencoded


If the replication is created, data replication immediately begins replicating data from the source to destination cluster and a response similar to the following is returned.

  "id": "9eee38236f3bf28406920213d93981a3/beer-sample/remote_beer"

The unique document ID returned in the JSON is a reference that is used to delete the replication.