MongoDB's replication is provided in the following diagram:
The primary server is the only one that can take writes at any time. The secondary servers are in a hot standby state, ready to take over if the primary server fails. Once the primary server fails, an election takes place regarding which secondary server will become primary.
We can also have arbiter nodes. Arbiter nodes do not hold any data, and their sole purpose is to participate in the election process.
We must always have an odd number of nodes (including arbiters). Three, five, and seven are all fine, so that in the event of the primary (or more servers) failing, we have a majority of votes in the election process.
When the other members of a replica set don't hear from the primary for more than 10 seconds (configurable), an eligible secondary will start the election process to...