Replica Set Primary
In the following three-member replica set, the primary accepts all write operations. Then the secondaries replicate the oplog to apply to their data sets.
All members of the replica set can accept read operations. However, by default, an application directs its read operations to the primary member. SeeRead Preferencefor details on changing the default read behavior.
In the following 3-member replica set, the primary becomes unavailable. This triggers an election which selects one of the remaining secondaries as the new primary.
| | Insome circumstances, two nodes in a replica set may_transiently_believe that they are the primary, but at most, one of them will be able to complete writes withwrite concern. The node that can completewrites is the current primary, and the other node is a former primary that has not yet recognized its demotion, typically due to a. When this occurs, clients that connect to the former primary may observe stale data despite having requested read preference, and new writes to the former primary will eventually roll back. |
| :—- | :—- |