Configuration
On this page
You can configure mongosync instances at startup
using a configuration file. The configuration file contains settings that are
the equivalent of mongosync
command line options.
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 mongosync.conf
Options
Note
The start
command provides additional options for features like
reversibility
and user write blocking
. For more details, see
the start API documentation.
acceptDisclaimer
Type: bool
Accepts disclaimers for the embedded verifier and, when using
mongosync
beta, beta features.When the
mongosync
process starts without this setting, the user is prompted to accept each disclaimer.This setting allows users who have already read and accepted disclaimers to accept the disclaimer and start the
mongosync
process.To set the
acceptDisclaimer
setting from the command line, see the--acceptDisclaimer
option.New in version 1.9.
cluster0
Type: 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
start
API endpoint.For more information on connecting
mongosync
, see Connections.To set the
cluster0
setting from the command line, see the--cluster0
option.
cluster1
Type: 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
start
API endpoint.For more information on connecting
mongosync
, see Connections.To set the
cluster1
setting from the command line, see the--cluster1
option.
disableTelemetry
Type: boolean
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 runmongosync
you can disable collection of this telemetry data.To set the
disableTelemetry
setting from the command line, see the--disableTelemetry
option.For more information, see User Data Collection.
id
Type: string
Sets an identifier for the
mongosync
instance.Use this setting when running multiple instances of
mongosync
on 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
listShards
command.To set the
id
setting from the command line, see the--id
option.
loadLevel
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
setting from the command line, see the--loadLevel
option.Warning
Setting
loadLevel
higher than the default of3
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
Type: 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
logPath
setting from the command line, see the--logPath
option.
migrationName
Type: string
Important
Cluster-to-Cluster Sync Beta Program
This feature is only available in
mongosync
beta. To learn more, see Cluster-to-Cluster Sync Beta Program.Starting in
mongosync-beta
1.8, sets a migration name for a sync operation. For example, you can set a migration name to identify each sync operation from multiple source clusters into one destination cluster.The
migrationName
string can contain up to 44 alphanumeric and underscore characters.migrationName
is appended to the string"mongosync_internal_"
to set the migration metadata database name.For example, if you set
migrationName
to"cluster_27000_to_cluster_35000_sync"
, the resultingmongosync
metadata database name is"mongosync_internal_cluster_27000_to_cluster_35000_sync"
.For complete examples, see Many-to-One Migrations or A->B->C Migrations.
To set the
migrationName
setting from the command line, see the--migrationName
option.
port
Type: integer
Default:
27182
Sets the port used by the HTTP server for the Cluster-to-Cluster Sync HTTP API.
To set the
port
setting from the command line, see the--port
option.
verbosity
Type: string
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
setting supports the following values:TRACE
DEBUG
INFO
WARN
ERROR
FATAL
PANIC
To set the
verbosity
setting from the command line, see the--verbosity
option.