Creating XDCR replications

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]
      
Note: 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

Curl request example:

curl -v -X POST -u admin:password1 
  http://10.4.2.4:8091/controller/createReplication
  -d fromBucket=beer-sample
  -d toCluster=remote1
  -d toBucket=remote_beer
  -d replicationType=continuous
  --d type=capi
      

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",
  "database": "http://10.4.2.4:8092/_replicator"
}

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