-
Book Overview & Buying
-
Table Of Contents
The Official MongoDB Guide
By :
A replica set in MongoDB is a group of mongod processes that maintain the same set of data. It provides redundancy and high availability and is the basis for all production deployments. By having several copies of your data across database servers, replication ensures a degree of fault tolerance, protecting against the loss of a single database server.
Maintaining copies of data in different data centers can increase data locality and availability for distributed applications. In some cases, replication can provide increased read capacity as clients are able to send read operations to different servers.
A replica set includes one primary node, which handles all write operations and logs all dataset changes in its operations log (oplog). The secondary nodes replicate the primary’s oplog and implement the operations on their own datasets. This ensures that they mirror the primary’s dataset. In the event that the primary becomes inaccessible, a qualified...