mongosync. View the
current documentation
for up-to-date guidance on mongosync and instructions on how to upgrade
to the latest version.mongosync binaries are not supported or tested for use with non-genuine MongoDB deployments. While the tools may work on these deployments, compatibility is not guaranteed.Definition
The mongosync binary is the primary process used in Mongosync.
mongosync migrates data from a source cluster to a
destination cluster until you finalize the sync.
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.
Compatibility
For details on version compatibility requirements, see MongoDB Server Version Compatibility.
mongosyncsupports replica sets and sharded clusters.Standalone MongoDB instances are not supported. Convert the standalone instance to a replica set before using Mongosync.
mongosyncdoes not support Atlas shared clusters or serverless instances.For a full list of limitations, see Mongosync Limitations.
Syntax
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.
Command Line Options
You can configure the following mongosync options using the command line.
To configure mongosync from a configuration file, see Configuration File.
Global Options
--acceptDisclaimerAccepts disclaimers for the embedded verifier.
When the
mongosyncprocess 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
mongosyncprocess.To set the
--acceptDisclaimeroption from a configuration file, see theacceptDisclaimersetting.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
startAPI endpoint.For more information on connecting
mongosync, see Connections.To set the
--cluster0option from a configuration file, see thecluster0setting.Warning
On some systems, providing a password in a connection string with the
--cluster0or--cluster1options may make the password visible to system status programs, such asps, that may be invoked by other users.Consider using the
--configoption 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
startAPI endpoint.For more information on connecting
mongosync, see Connections.To set the
--cluster1option from a configuration file, see thecluster1setting.Warning
On some systems, providing a password in a connection string with the
--cluster0or--cluster1options may make the password visible to system status programs, such asps, that may be invoked by other users.Consider using the
--configoption 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
mongosyncDuring Synchronization.For more information, see Configuration File.
--disableTelemetryNew in version 1.4.0.
Disables the collection of telemetry data for
mongosync.By default,
mongosynccollects anonymous, aggregated usage data to improve MongoDB products. When you runmongosyncyou can disable collection of this telemetry data.To set the
--disableTelemetryoption from a configuration file, see thedisableTelemetrysetting.To disable telemetry data collection during a migration, see Reconfigure
mongosyncDuring Synchronization.For more information, see User Data Collection.
--disableVerificationDisables the Embedded Verifier. When disabled,
mongosyncdoes 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
mongosyncwith 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
mongosyncis initially started. Instead, disable verification with the /start request parameterverification.enabled: falsesince verification is enabled by default.To disable verification from the configuration file, see the
disableVerificationsetting.New in version 1.10.
--id <id>Sets an identifier for the
mongosyncinstance.Use this option when running multiple instances of
mongosyncon 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
listShardscommand.To set the
--idoption from a configuration file, see theidsetting.
--loadLevel <level>Type: integer
Default:
3Sets 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
--loadLeveloption from a configuration file, see theloadLevelsetting.To change the load level during a migration, see Reconfigure
mongosyncDuring Synchronization.Warning
Setting
loadLevelhigher than the default of3may negatively impact the destination cluster performance.If read bottlenecks exist on the source cluster or if write bottlenecks exist on the destination cluster, decreasing
loadLevelmight improve performance.New in version 1.4.
--logPath <directory>Sets the path to the log directory. Mongosync writes logs to files in this directory.
For more information, see Logging.
To set the
--logPathoption from a configuration file, see thelogPathsetting.To change the path to the log directory during a migration, see Reconfigure
mongosyncDuring Synchronization.Note
If you start
mongosyncwith the--logPathoption, you can send aUSR1signal to themongosyncprocess to rotate its log file:kill -s USR1 $mongosync_pid $mongosync_pidis themongosyncprocess ID.
--portDefault:
27182Sets the port used by the HTTP server for the Mongosync HTTP API.
To set the
--portoption from a configuration file, see theportsetting.To change the port during a migration, see Reconfigure
mongosyncDuring Synchronization.
--verbosity <level>Default:
DEBUGSets the verbosity level to use in log messages. Mongosync logs all messages at the specified level and any messages at lower levels.
The
--verbosityoption supports the following values:TRACEDEBUGINFOWARNERRORFATALPANIC
To set the
--verbosityoption from a configuration file, see theverbositysetting.To change the verbosity level during a migration, see Reconfigure
mongosyncDuring Synchronization.
Behavior
For more information, see
mongosync Behavior.