Docs Menu

Docs HomeMongoDB Cluster-to-Cluster Sync

mongosync States

On this page

  • View the Current State
  • State Descriptions
  • Read Operations
  • Write Operations
  • Write-blocking

mongosync enters different states depending on the requests it receives. mongosync can only be in a single state at a given time. The current mongosync states determines which API operations you can run.

This page describes mongosync states.

To view the current state of mongosync, use the /progress. endpoint. The /progress endpoint returns the state in the state field.

The following table describes each state and lists the permitted operations in that state.

State
Description
Possible API Operations

IDLE

mongosync is initialized and ready for a sync job to begin.
RUNNING
The sync process is currently running. In this state, data is initially synced to the destination cluster. Subsequent writes to the source cluster are applied to the destination cluster.
PAUSED
The sync process is paused. To resume the sync process, send a request to the /resume endpoint.

COMMITTING

The cutover for the sync process has started. The time it takes to transition to the COMMITTED phase depends on lagTimeSeconds. To monitor lagTimeSeconds or to see if mongosync has finished committing, use the /progress endpoint.
COMMITTED
The cutover for the sync process is complete.

Read operations on the source cluster are always permitted.

When the /progress endpoint reports canWrite is true, the data on the source and destination clusters is consistent.

To see what state mongosync is in, call the /progress API endpoint. The /progress output includes a boolean value, canWrite.

  • When canWrite is true, it is safe to write to the destination cluster.

  • When canWrite is false, do not write to the destination cluster.

You can safely write to the source cluster while mongosync is syncing. Do not write to the destination cluster unless canWrite is true.

When write-blocking is enabled, mongosync blocks writes:

  • On the destination cluster during sync

  • On the source cluster while committing

To enable write-blocking, use the start API to set enableUserWriteBlocking to true. You cannot enable write-blocking after the sync starts.

To set enableUserWriteBlocking, the mongosync user must have a role that includes the setUserWriteBlockMode and bypassWriteBlockingMode ActionTypes.

Note

When using enableUserWriteBlocking, writes are only blocked for users that do not have the bypassWriteBlockingMode ActionType. Users who have this ActionType are able to perform writes.

←  reverseFiltered Sync →
Share Feedback
© 2023 MongoDB, Inc.

About

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