Docs Menu

mongosync

The mongosync binary is the primary process used in Cluster-to-Cluster Sync. mongosync migrates data from a source cluster to a destination cluster and keeps the clusters in continuous sync until you finalize the sync. In addition to continuous data synchronization, mongosync can also perform a one time data migration between clusters.

For an overview of the mongosync process, see About mongosync.

To get started with mongosync, refer to the Quick Start Guide.

The Frequently Asked Questions (FAQ) page addresses questions users have asked about mongosync.

The mongosync command layout below is modified for display. To connect cluster0 to cluster1 with mongosync, enter the following command on one line:

mongosync \
--cluster0 "<cluster0_connection_string>" \
--cluster1 "<cluster1_connection_string>"

For more information on how to format your connection strings, see Connecting mongosync.

You can configure the following mongosync options using the command line.

To configure mongosync from a configuration file, see Configuration File.

--acceptDisclaimer

Accepts disclaimers for the embedded verifier.

When the mongosync process starts without this option, the user is prompted to accept each disclaimer.

This option allows users who have already read and accepted disclaimers to accept the disclaimer and start the mongosync process.

To set the --acceptDisclaimer option from a configuration file, see the acceptDisclaimer setting.

New in version 1.9.

--cluster0 <uri>

Sets the connection URI for the first cluster. The first cluster can serve as either the source or the destination in the sync process. Designate the source and destination clusters in the call to the start API endpoint.

For more information on connecting mongosync, see Connections.

To set the --cluster0 option from a configuration file, see the cluster0 setting.

Warning

On some systems, providing a password in a connection string with the --cluster0 or --cluster1 options may make the password visible to system status programs, such as ps, that may be invoked by other users.

Consider using the --config option to specify a configuration file containing the password instead.

--cluster1 <uri>

Sets the connection URI for the second cluster. The second cluster can serve as either the source or the destination in the sync process. Designate the source and destination clusters in the call to the start API endpoint.

For more information on connecting mongosync, see Connections.

To set the --cluster1 option from a configuration file, see the cluster1 setting.

Warning

On some systems, providing a password in a connection string with the --cluster0 or --cluster1 options may make the password visible to system status programs, such as ps, that may be invoked by other users.

Consider using the --config option to specify a configuration file containing the password instead.

--config <filename>

Sets the path to the configuration file.

To set the configuration file path during a migration, see Reconfigure mongosync During Synchronization.

For more information, see Configuration File.

--disableTelemetry

New in version 1.4.0.

Disables the collection of telemetry data for mongosync.

By default, mongosync collects anonymous, aggregated usage data to improve MongoDB products. When you run mongosync you can disable collection of this telemetry data.

To set the --disableTelemetry option from a configuration file, see the disableTelemetry setting.

To disable telemetry data collection during a migration, see Reconfigure mongosync During Synchronization.

For more information, see User Data Collection.

--disableVerification

Disables the Embedded Verifier. When disabled, mongosync does not verify the migration. For alternative verification methods, see Verify Data Transfer.

This option provides a workaround for customers who experience OOM kills when running mongosync with verification and cannot allocate more resources or tolerate restarting verification. It allows the migration to complete with verification disabled. Verification remains disabled for subsequent restarts and reversals.

This option should not be used when mongosync is initially started. Instead, disable verification with the /start request parameter verification.enabled: false since verification is enabled by default.

To disable verification from the configuration file, see the disableVerification setting.

New in version 1.10.

--help, -h

Prints usage information to stdout.

--id <id>

Sets an identifier for the mongosync instance.

Use this option when running multiple instances of mongosync on a sharded cluster, to synchronize the shards individually.

The identifier value for this option must correspond to the shard ID of the shard it syncs. To find the shard ID, use the listShards command.

To set the --id option from a configuration file, see the id setting.

--loadLevel <level>

Type: integer

Default: 3

Sets the cluster workload level for syncing data between the source and destination clusters:

  • 4, the highest setting, maximizes cluster workload and syncs data the fastest.

  • 1, the lowest setting, minimizes cluster workload and syncs data the slowest.

To set the --loadLevel option from a configuration file, see the loadLevel setting.

To change the load level during a migration, see Reconfigure mongosync During Synchronization.

Warning

Setting loadLevel higher than the default of 3 may negatively impact the destination cluster performance.

If read bottlenecks exist on the source cluster or if write bottlenecks exist on the destination cluster, decreasing loadLevel might improve performance.

New in version 1.4.

--logPath <directory>

Sets the path to the log directory. Cluster-to-Cluster Sync writes logs to files in this directory.

For more information, see Logging.

To set the --logPath option from a configuration file, see the logPath setting.

To change the path to the log directory during a migration, see Reconfigure mongosync During Synchronization.

Note

If you start mongosync with the --logPath option, you can send a USR1 signal to the mongosync process to rotate its log file:

kill -s USR1 $mongosync_pid

$mongosync_pid is the mongosync process ID.

--port

Default: 27182

Sets the port used by the HTTP server for the Cluster-to-Cluster Sync HTTP API.

To set the --port option from a configuration file, see the port setting.

To change the port during a migration, see Reconfigure mongosync During Synchronization.

--verbosity <level>

Default: DEBUG

Sets the verbosity level to use in log messages. Cluster-to-Cluster Sync logs all messages at the specified level and any messages at lower levels.

The --verbosity option supports the following values:

  • TRACE

  • DEBUG

  • INFO

  • WARN

  • ERROR

  • FATAL

  • PANIC

To set the --verbosity option from a configuration file, see the verbosity setting.

To change the verbosity level during a migration, see Reconfigure mongosync During Synchronization.

--version, -v

Prints mongosync version information to stdout.

For more information, see mongosync Behavior.