Chapter 1 · Practice 2 of 3
Deploy a replica set, even for small applications
Why it matters
A standalone mongod has no automatic failover, so one crashed machine means downtime, and it cannot run multi-document transactions, which need a replica set (or a sharded cluster).
A three-member replica set gives you:
- automatic failover when the primary fails
- data on more than one machine
- transactions and change streams
- the option to read from secondaries for analytics
Use three data-bearing members where you can. Spread them across failure zones, and connect with the replica set connection string (or mongodb+srv://) so drivers discover members and fail over on their own.