Docs Menu

Docs HomeMongoDB Cluster-to-Cluster Sync


On this page

  • Description
  • Requirements
  • Request
  • Request Body Parameters
  • Response
  • Example
  • Request
  • Response
  • Behavior

Reverses the direction of a committed sync operation.

For example:

  • You have a COMMITTED sync operation.

  • cluster0 is the source and cluster1 is the destination.

  • After the sync operation is COMMITTED, new writes occur only on the destination cluster. The source cluster will not accept new writes.

In this scenario, you can use the reverse endpoint to sync writes from cluster1 to cluster0.

To use the reverse endpoint:

  • mongosync must be configured when the initial sync begins. The call to the /start API endpoint must set:

    • reversible to true

    • enableUserWriteBlocking to true

    You cannot update these options after the sync starts.

  • mongosync must be in the COMMITTED state.

  • Source and destination clusters must be MongoDB 6.0 or later.

  • Unique indexes on the original source cluster must be formatted properly. If an upgraded cluster has unique indexes that were created in MongoDB 4.2 or earlier, you must resync all of the nodes in the original source cluster before reversing.

  • The source and destination clusters must have the same number of shards. You cannot reverse sync when the clusters have different topologies.

  • The user specified in the mongosync connection string must have the required permissions on the source and destination clusters. The permissions vary depending on your environment and if you want to run a write-blocking or reverse sync.

POST /api/v1/reverse

This endpoint does not use HTTP request body parameters. However, you must specify the --data option with an empty object { }.

When the request is successful, this value is true.
If an error occurred, indicates the name of the error. This field is omitted from the response when success is true.
Detailed description of the error that occurred. This field is omitted from the response when success is true.

The following example reverses the direction of a committed sync operation.

curl localhost:27182/api/v1/reverse -XPOST --data '{ }'

If the reverse request is successful, mongosync enters the RUNNING state. The synchronization continues in the reverse direction from the original sync job. You do not need to restart the entire sync process to copy the original data.

To view the mapping direction for the synchronization of the source and destination clusters, use the progress endpoint and check the directionMapping object.

←  commitmongosync States →
Share Feedback
© 2023 MongoDB, Inc.


  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2023 MongoDB, Inc.