Setting Destination Cluster References

To create an XDCR reference to a destination cluster, use the POST /pools/default/remoteClusters HTTP method and URI.

Description

To use XDCR, source and destination clusters must be established. A source cluster is the cluster where the original data is stored. A destination cluster is the cluster where the replica data is stored. Data is copied from the source cluster to the destination cluster.

HTTP method and URI

POST /pools/default/remoteClusters

Syntax

Curl request syntax:

curl -v -u [admin]:[password]
  http://[localhost]:[port]/pools/default/remoteClusters
  -d uuid=[destination-cluster-uuid]
  -d name=[destination-cluster-name]
  -d hostname=[remote-host]:[port]
  -d username=[admin]
  -d password=[password]

Example

Credentials are provided for the source cluster and information, including credentials and UUID for the destination cluster.

Curl request example:

curl -v -u Administrator:password1 \
  http://10.4.2.4:8091/pools/default/remoteClusters \
  -d 'uuid=9eee38236f3bf28406920213d93981a3' \
  -d 'name=remote1' \
  -d 'hostname=10.4.2.6:8091' \
  -d 'username=admin' \
  -d 'password=password2'

Raw HTTP request example:

POST /pools/default/remoteClusters HTTP/1.1
Authorization: Basic QWRtaW5pc3RyYXRvcjpwYXNzd29yZA==
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: 114
Content-Type: application/x-www-form-urlencoded

Response

If successful, Couchbase Server responds with a JSON response similar to the following:

{"name":"remote1","uri":"/pools/default/remoteClusters/remote1",
"validateURI":"/pools/default/remoteClusters/remote1?just_validate=1",
"hostname":"10.4.2.6:8091",
"username":"Administrator",
"uuid":"9eee38236f3bf28406920213d93981a3",
"deleted":false}

The following describes the response elements:

  • (String) name: Name of the destination cluster referenced for XDCR.

  • (String) validateURI: URI to validate details of cluster reference.

  • (String) hostname: Hostname/IP (and :port) of the remote cluster.

  • (String) username: Username for the destination cluster administrator.

  • (String) uuid: UUID of the remote cluster reference.

  • (Boolean) deleted: Indicates whether the reference to the destination cluster has been deleted or not.