beginnerMongoDB — Indexing, Replica Sets & Sharding
What is a MongoDB replica set and how does automatic failover work?
A replica set is a group of mongod instances that maintain the same dataset. Typically: 1 primary + 2 secondaries. The primary accepts all writes. Secondaries replicate via the oplog (operation log) and can serve reads. Failover: if the primary becomes unreachable (heartbeat timeout ~10s), the remaining members hold an election. Each eligible secondary votes; the secondary with the most up-to-date
This is a Pro chapter
Sign in, then upgrade to Pro or Power to unlock this and the full Databases Mastery library.
What is a MongoDB replica set and how does automatic failover work?