Docs Home → MongoDB Cluster-to-Cluster Sync
Frequently Asked Questions
On this page
- Can
mongosync
run on its own hardware? - Should I increase the size of the
oplog
in the source cluster? - Which connection string options does
mongosync
allow? - Which security and authentication options are supported?
- Can I configure
mongosync
for high availability? - Can the source or destination be a replica set with arbiters?
- What if I see a Slow Operation Warning?
This page provides answers to some frequently asked questions we have encountered. If you have additional questions please contact MongoDB Support.
Can mongosync
run on its own hardware?
Yes, mongosync
can run on its own hardware. mongosync
does not
have to run on the servers that host your MongoDB instances. When
mongosync
runs on its own hardware, it can use an operating system
(OS) that is different than the OS on the source or destination
clusters.
Should I increase the size of the oplog
in the source cluster?
The oplog is a capped collection that keeps a rolling record of all operations that modify the data stored in your databases.
mongosync
applies operations in the oplog
on the source cluster
to the data on the destination cluster. When operations
that mongosync
has not applied roll off the oplog
on the source cluster, the sync fails and mongosync
exits.
During the initial sync, mongosync
may apply operations at a slower
rate due to the load imposed by copying documents concurrently.
After mongosync
completes the initial sync, it applies changes
faster and is more likely to maintain a position in the oplog
that is close to the real-time writes occuring on the source cluster.
If you anticipate syncing a large data set, or if you plan to pause
synchronization for an extended period of time, you might exceed the
oplog window. Use the oplogSizeMB
setting
to increase the size of the oplog
on the source cluster.
To learn more about how to increase the size of the oplog
, see:
Change the Size of the Oplog.
Which connection string options does mongosync
allow?
mongosync
requires readConcern: "majority"
and writeConcern: "majority".
If the readConcern
is not majority
, mongosync
returns an
error:
Invalid URI option, read concern must be majority
If the writeConcern
is not majority
, mongosync
returns an
error:
Invalid URI option, write concern must be majority
mongosync
accepts all other connection string options.
Which security and authentication options are supported?
mongosync
uses a standard MongoDB connection string to connect to the source and destination clusters.
LDAP and X509 are supported. For available authentication options, see Authentication.
Can I configure mongosync
for high availability?
There is no automatic failover built into mongosync
. However you
can write a script or use your operating system's process managers,
systemd
for example, to restart the mongosync
process.
The mongosync
binary is stateless. The metadata for restarting is
stored on the destination cluster.
A mongosync
operation can be resumed if mongosync
becomes
unavailable during synchronization. When mongosync
becomes
available again, restart the mongosync
process with the same
parameters. mongosync
resumes the operation from where it stopped
when mongosync
became unavailable.
Can the source or destination be a replica set with arbiters?
Yes, the replica set can have arbiters. The source replica set must have more than 2 non-arbiter nodes and you must sync from a non-arbiter node. Use the source cluster's connection string to specify a read preference for a non-arbiter, data-bearing node.
What if I see a Slow Operation Warning?
Slow operation warnings can occur during the initial sync or the application of a change event when there is a slow read operation on the source cluster or a slow write operation on the destination cluster. The warning may indicate network congestion or resource strain on the source or destination cluster.
While these warnings do not indicate failures in themselves, slow operations
can cause operation timeout errors in mongosync
and migration failures.
If you see slow operation warnings, check CPU, memory, and network usage on the source and destination clusters. If the clusters are underprovisioned for your needs, consider upgrading the cluster hardware.