0
0
MongoDBquery~5 mins

Automatic failover behavior in MongoDB - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
APrimary node becomes unreachable
BSecondary node receives a write
CClient disconnects
DBackup completes
During failover, how is the new primary chosen?
ANode with the most data
BMajority vote among eligible secondaries
CRandom selection
DOldest node
What is the purpose of heartbeat messages in MongoDB replica sets?
ATo check node availability
BTo backup data
CTo transfer data
DTo authenticate users
What happens if a majority of nodes cannot communicate with the primary?
APrimary remains primary
BReplica set shuts down
CAn election is triggered to select a new primary
DAll writes are blocked permanently
Why is it important to have an odd number of voting members in a replica set?
ATo reduce storage
BTo improve backup speed
CTo increase write speed
DTo simplify elections and avoid ties
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.