Creating XDCR Replications

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

Description

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

Syntax

Curl request syntax:

curl -v -X POST -u [admin]:[password]
  http://[localhost]:[port]/controller/createReplication
  -d fromBucket=[bucket-name]
  -d toCluster=[cluster-name]
  -d toBucket=[bucket-name]
  -d replicationType=continuous
  -d type=[capi | xmem]
  -d compressionType=["None" | "Auto" | "Snappy"]
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.

Example

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

curl -v -X POST -u Administrator:password \
http://127.0.0.1:8091/controller/createReplication \
-d fromBucket=source \
-d toCluster=10.142.171.101 \
-d toBucket=remote \
-d replicationType=continuous \
-d compressionType="Snappy"

Raw HTTP request:

POST / HTTP/1.1
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
Host: 10.4.2.4:8091
Accept: */*
Content-Length: 126
Content-Type: application/x-www-form-urlencoded

Response

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.