- FAQ: Replication and Replica Sets
- What kind of replication does MongoDB support?
- Does replication work over the Internet and WAN connections?
- Can MongoDB replicate over a “noisy” connection?
- Why use journaling if replication already provides data redundancy?
- What information do arbiters exchange with the rest of the replica set?
- Is it normal for replica set members to use different amounts of disk space?
- Can I rename a replica set?
FAQ: Replication and Replica Sets
This document answers common questions about replication in MongoDB.See also the Replication section in the manual, which providesan overview of replication, including details on:
What kind of replication does MongoDB support?
MongoDB supports replica sets, which can have upto 50 nodes.
MongoDB 4.0 removes support for the deprecated master-slavereplication.
Does replication work over the Internet and WAN connections?
Yes.
For example, a deployment may maintain a primary and secondaryin an East-coast data center along with a secondary member for disasterrecovery in a West-coast data center.
See also
Deploy a Geographically Redundant Replica Set
Can MongoDB replicate over a “noisy” connection?
Yes, but not without connection failures and the obvious latency.
Members of the set will attempt to reconnect to the other members ofthe set in response to networking flaps. This does not requireadministrator intervention. However, if the network connectionsamong the nodes in the replica set are very slow, it might not bepossible for the members of the node to keep up with the replication.
See also
Why use journaling if replication already provides data redundancy?
Journaling facilitates faster crash recovery.
Journaling is particularly useful for protectionagainst power failures, especially if your replica set resides in a single datacenter or power circuit.
When a replica set runs with journaling, you can safely restartmongod
instances without additional intervention.
Note
Journaling requires some resource overhead for writeoperations. Journaling has no effect on read performance, however.
Journaling is enabled by default on all 64-bitbuilds of MongoDB v2.0 and greater.
What information do arbiters exchange with the rest of the replica set?
Arbiters never receive the contents of a collection but do exchange thefollowing data with the rest of the replica set:
- Credentials used to authenticate the arbiter with the replica set.These exchanges are encrypted.
- Replica set configuration data and voting data. This information isnot encrypted. Only credential exchanges are encrypted.
If your MongoDB deployment uses TLS/SSL, then all communicationsbetween arbiters and the other members of the replica set are secure.
See the documentation for Configure mongod and mongos for TLS/SSL for moreinformation. As with all MongoDB components, run arbiters on securenetworks.
See
The overview ofArbiter Members of Replica Sets.
Is it normal for replica set members to use different amounts of disk space?
Yes.
Factors including: different oplog sizes, different levels of storagefragmentation, and MongoDB’s data file pre-allocation can lead to somevariation in storage utilization between nodes. Storage usedisparities will be most pronounced when you add members at differenttimes.
Can I rename a replica set?
No.
You can use the backup and restore procedure described in theRestore a Replica Set from MongoDB Backups tutorial to create anew replica set with the desired name. Downtime may be necessary inorder to ensure parity between the original replica set and the new one.