Pause a Replication
Pausing an XDCR replication temporarily suspends the replication of data from the source bucket to the target.
Examples on This Page
The examples in the subsections below show how to pause the same replication; using the UI, the CLI, and the REST API respectively. As their starting-point, the examples assume the scenario that concluded the page Create a Replication.
Pause an XDCR Replication with the UI
Step 1: Access Couchbase Web Console. Left-click on the XDCR tab, in the right-hand navigation menu.
This displays the XDCR Replications screen. The lower part of the main panel, entitled Outgoing Replications, currently has the following appearance:
This shows the single replication that is in progress.
Note that the status column displays a status of replicating.
Step 2: To pause replication, left-click on the row for the replication. The row is redisplayed, as follows:
Three interactive buttons are now displayed. These respectively allow you to Delete, Edit, or Pause the replication. To pause, left-click on the Pause button:
Initially, a notification declares that the replication is in the process of being paused:

Subsequently, the notification changes to indicate that the replication has been paused:

The Pause button has duly become a Run button.
Pause an XDCR Replication with the CLI
From the starting-point defined above, in Examples on This Page, use the CLI xdcr-replicate command to pause an XDCR replication as follows.
First, determine the stream-id of the replication that you wish to pause.
Use xdcr-replicate with the --list option, in order to list all ongoing replications from the source cluster:
couchbase-cli xdcr-replicate -c 10.142.180.101 -u Administrator -p password \ --list
This produces the following output:
stream id: 570d0ca2db3b1e128e2fafd362a1bfd4/travel-sample/travel-sample status: paused source: travel-sample target: /remoteClusters/570d0ca2db3b1e128e2fafd362a1bfd4/buckets/travel-sample
The stream-id consists of three components, which are, in sequence:
-
570d0ca2db3b1e128e2fafd362a1bfd4: Theuuidof the reference. -
travel-sample: The name of the source bucket. -
travel-sample: The name of the target bucket.
With this information, to pause the replication, use the xdcr-replicate command with the --pause and --xdcr-replicator options, as follows:
couchbase-cli xdcr-replicate -c 10.142.180.101 \ -u Administrator \ -p password \ --pause \ --xdcr-replicator=570d0ca2db3b1e128e2fafd362a1bfd4/travel-sample/travel-sample
If successful, this returns the following:
SUCCESS: XDCR replication paused
The replication is now paused.
Pause an XDCR Replication with the REST API
From the starting-point defined above, in Examples on This Page, use the REST API to pause an XDCR replication as follows.
First, determine the id of the replication that you wish to pause.
Use the /pools/default/tasks endpoint, to produce a list of tasks for the source cluster:
curl -i -X GET -u Administrator:password http://10.142.180.101:8091/pools/default/tasks
Formatted, the output is as follows:
[
{
"type": "rebalance",
"status": "notRunning",
"statusIsStale": false,
"masterRequestTimedOut": false
},
{
"cancelURI": "/controller/cancelXDCR/570d0ca2db3b1e128e2fafd362a1bfd4%2Ftravel-sample%2Ftravel-sample",
"settingsURI": "/settings/replications/570d0ca2db3b1e128e2fafd362a1bfd4%2Ftravel-sample%2Ftravel-sample",
"status": "running",
"replicationType": "xmem",
"continuous": true,
"filterExpression": "",
"id": "570d0ca2db3b1e128e2fafd362a1bfd4/travel-sample/travel-sample",
"pauseRequested": false,
"source": "travel-sample",
"target": "/remoteClusters/570d0ca2db3b1e128e2fafd362a1bfd4/buckets/travel-sample",
"type": "xdcr",
"recommendedRefreshPeriod": 10,
"changesLeft": 0,
"docsChecked": 3111,
"docsWritten": 0,
"maxVBReps": null,
"errors": []
}
]
The value associated with the id key is the stream-id for the replication: featuring, in sequence, the id (570d0ca2db3b1e128e2fafd362a1bfd4) of the reference, the name of the source bucket (travel-sample), and the name of the target bucket (travel-sample).
Secondly, use the settings/replications URI with the pauseRequested flag set to true, to pause the replication:
curl -X POST -u Administrator:password \ > http://10.142.180.101:8091/settings/replications/570d0ca2db3b1e128e2fafd362a1bfd4%2Ftravel-sample%2Ftravel-sample \ > -d pauseRequested=true
Note the encoded form of the endpoint, which is required. Formatted, the output is as follows:
{
"checkpointInterval": 600,
"compressionType": "Auto",
"docBatchSizeKb": 2048,
"failureRestartInterval": 10,
"filterExpression": "",
"logLevel": "Info",
"networkUsageLimit": 0,
"optimisticReplicationThreshold": 256,
"pauseRequested": true,
"sourceNozzlePerNode": 2,
"statsInterval": 1000,
"targetNozzlePerNode": 2,
"type": "xmem",
"workerBatchSize": 500
}
The replication is now paused.
For more information, see Pausing and Resuming a Replication.
Auto-Paused Replications
Starting with Couchbase Server 8.0.3, XDCR can also pause a replication automatically when it detects a set number of conflicts within a set time. An automatic pause gives you time to find the cause of the conflicts and fix it before you resume the replication.
Auto-pause works only for a replication that has Conflict Logging enabled, because it counts the conflicts that the conflict logger detects.
Configure Auto-Pause
Auto-pause uses 2 replication settings:
| Setting | Default | Description |
|---|---|---|
|
|
The number of conflicts that any single source node can detect within a monitoring window before XDCR pauses the replication. |
|
|
The length of the monitoring window, in seconds, from 0 to 2592000 (30 days). When a window ends, the count starts again from 0. |
To turn on auto-pause, set both settings to values greater than 0. To turn it off, set both to 0. A value greater than 0 for either setting while the other is 0 returns an error. Every node in the source cluster must run Couchbase Server 8.0.3 or later.
Set them with the REST API, for a single replication or as the defaults for new replications. For the parameters, see Managing Advanced Settings.
When auto-pause is on:
-
XDCR checks each source node’s conflict count every second, so it can pause the replication before the window ends.
-
When any single source node reaches
cLogPauseReplThresholdconflicts within the window, XDCR pauses the replication on the whole cluster. -
A change to either setting takes effect from the start of the next window.
When auto-pause is off, the conflict logger handles a surge of conflicts by hibernating, and the replication continues.
Find an Auto-Paused Replication
When XDCR auto-pauses a replication:
-
Under in the Couchbase Server Web Console, the replication shows as paused.
-
An error message for the replication states that XDCR auto-paused it, and gives the detected conflict count, the threshold, and the monitoring duration.
-
The
goxdcr.logfile on the source node that reached the threshold records the same values.
Resume an Auto-Paused Replication
-
Review the conflict log records to find the documents and applications causing the conflicts. See Viewing Conflict Logs.
-
Fix the cause, for example by stopping an application that writes the same documents on both clusters.
-
Resume the replication in the same way as a replication you paused yourself. See Resume a Replication.
Resuming starts a new monitoring window with a count of 0. If the conflicts continue, XDCR pauses the replication again.
Next Steps
Once a replication has been paused, you can opt to resume it. See Resume a Replication.