Recall & Review
beginner
What is automatic failover in MongoDB?
Automatic failover is the process where MongoDB automatically switches to a new primary node if the current primary becomes unavailable, ensuring the database stays available without manual intervention.
Click to reveal answer
beginner
What role does a 'primary' node play in MongoDB replica sets?
The primary node receives all write operations and replicates data to secondary nodes. It is the main point for data changes in the replica set.
Click to reveal answer
intermediate
How does MongoDB detect a primary node failure?
MongoDB members send heartbeats to each other. If a majority of nodes do not receive a heartbeat from the primary within a timeout, they consider it down and start an election for a new primary.
Click to reveal answer
intermediate
What is the election process in MongoDB automatic failover?
When the primary fails, eligible secondary nodes hold an election to select a new primary. The node that wins the majority vote becomes the new primary and starts accepting writes.
Click to reveal answer
advanced
Why is a majority vote important in MongoDB failover?
A majority vote prevents split-brain scenarios by ensuring only one primary is elected. This keeps data consistent and avoids conflicts.
Click to reveal answer
What triggers automatic failover in a MongoDB replica set?
✗ Incorrect
Automatic failover happens when the primary node is unreachable or considered down by the replica set members.
During failover, how is the new primary chosen?
✗ Incorrect
Eligible secondary nodes hold an election and the one with majority votes becomes the new primary.
What is the purpose of heartbeat messages in MongoDB replica sets?
✗ Incorrect
Heartbeat messages help nodes check if other members, especially the primary, are alive and reachable.
What happens if a majority of nodes cannot communicate with the primary?
✗ Incorrect
If the primary is unreachable by a majority, an election is triggered to maintain availability.
Why is it important to have an odd number of voting members in a replica set?
✗ Incorrect
An odd number of voting members helps avoid tie votes during elections, ensuring smooth failover.
Explain how MongoDB handles automatic failover when the primary node fails.
Think about how nodes communicate and decide who becomes the new leader.
You got /5 concepts.
Describe why majority voting is critical in MongoDB's automatic failover mechanism.
Consider what could happen if two primaries existed at the same time.
You got /4 concepts.