Replication has been one of the most useful features of MongoDB since the very early days. In general, replication refers to the process of synchronizing data across different servers. The benefits of replication include protection from data loss and high availability of data. Replication also provides disaster recovery, an avoidance of downtime for maintenance, scaling reads (since we can read from multiple servers), and scaling writes (only if we can write to multiple servers).
In this chapter, we will cover the following topics:
- An architectural overview, elections, and the use cases for replication
- Setting up a replica set
- Connecting to a replica set
- Replica set administration
- The best practices for deploying replica sets using cloud providers
- Replica set limitations