mongosync usage and instructions on how
to upgrade your version of mongosync.You can configure mongosync instances at startup
by using command line options or a configuration file.
The configuration file specifies values for settings that are
the equivalent of mongosync command line options.
During a migration, you can reconfigure certain mongosync settings by following the
steps in Reconfigure mongosync During Synchronization.
Configuration File
You can write most mongosync
command line options to a YAML file. The
configuration file specifies values for each setting using YAML format.
For example:
cluster0: "mongodb://192.0.2.10:27017" cluster1: "mongodb://192.0.2.20:27017" logPath: "/var/log/mongosync" verbosity: "WARN"
To use a configuration file, start mongosync with the
--config option to set the path to the file:
mongosync --config <configPath>
Settings
You can configure the following mongosync settings using a configuration file.
To configure mongosync from the command line, see Command Line Options.
Note
The start command provides additional options for features like
reversibility and user write blocking. For more details, see
the start API documentation.
cluster0Type: string
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
cluster0setting from the command line, see the--cluster0option.
cluster1Type: string
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
cluster1setting from the command line, see the--cluster1option.
disableTelemetryType: boolean
New 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
disableTelemetrysetting from the command line, see the--disableTelemetryoption.For more information, see User Data Collection.
idType: string
Sets an identifier for the
mongosyncinstance.Use this setting when running multiple instances of
mongosyncon a sharded cluster, to synchronize the shards individually.The identifier value for this setting must correspond to the shard ID of the shard it syncs. To find the shard ID, use the
listShardscommand.To set the
idsetting from the command line, see the--idoption.
loadLevelType: 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
loadLevelsetting from the command line, see the--loadLeveloption.Warning
Setting
loadLevelhigher than the default of3may negatively impact the destination cluster performance.New in version 1.4.
logPathType: string
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
logPathsetting from the command line, see the--logPathoption.
portType: integer
Default:
27182Sets the port used by the HTTP server for the Cluster-to-Cluster Sync HTTP API.
To set the
portsetting from the command line, see the--portoption.
verbosityType: string
Default:
DEBUGSets 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
verbositysetting supports the following values:TRACEDEBUGINFOWARNERRORFATALPANIC
To set the
verbositysetting from the command line, see the--verbosityoption.
Reconfigure mongosync During Synchronization
Important
Only the following settings can be adjusted during a migration.
Other settings must remain unchanged between mongosync restarts.
While mongosync is syncing, you can reconfigure the --config, --disableTelemetry,
--loadLevel, --logPath, --port, and --verbosity options
by performing the following steps:
(Optional) Pause the mongosync processes
Run pause on each running mongosync process.
You can resume the mongosync processes later from the paused
state, as shown in the final step.
Tip
If you don't want to immediately resume data synchronization
operations after reconfiguration, consider pausing the
mongosync processes. This is useful if you're coordinating
operations from multiple mongosync processes.
(Optional) Update your configuration file
If you used the --config option to set the path to a configuration file
when you first initialized mongosync, update this configuration file with the new value for each setting.
Initialize the mongosync processes
If you updated a configuration file in the last step, initialize
the mongosync processes with the --config option
set to the path of the updated configuration file:
mongosync --config <configPath>
If you did not use the --config option when you first initialized mongosync,
initialize the mongosync processes with the command line options set to their updated values:
mongosync \ --cluster0 "<cluster0_connection_string>" \ --cluster1 "<cluster1_connection_string>" \ --loadLevel <newLevel>
For more information, see Initialize mongosync.
Start or Resume the mongosync processes
If you paused any mongosync processes earlier in the optional first step,
run resume on the paused mongosync processes.
If you stopped any mongosync processes without using pause,
run start on the stopped mongosync processes.
For more detailed instructions, see Synchronize Data Between Clusters.
mongosync resumes the sync roughly where it was before you stopped the earlier proceses.
Any partitions that were in progress at the time of termination will restart from the beginning.