Challenge - 5 Problems
Replica Set Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Primary role in a MongoDB replica set
In a MongoDB replica set, what is the main responsibility of the primary node?
Attempts:
2 left
💡 Hint
Think about which node accepts changes from users.
✗ Incorrect
The primary node is responsible for accepting all write operations and then replicating those changes to the secondary nodes to keep data consistent.
❓ query_result
intermediate2:00remaining
Output of rs.status() command
What key information does the rs.status() command provide in a MongoDB replica set?
Attempts:
2 left
💡 Hint
Think about what status means for nodes in a set.
✗ Incorrect
The rs.status() command reports the health and state of each member in the replica set, such as which is primary, secondary, or if any are down.
📝 Syntax
advanced2:00remaining
Correct syntax to initiate a replica set
Which of the following commands correctly initiates a MongoDB replica set named 'rs0' with one member?
MongoDB
rs.initiate({ _id: 'rs0', members: [{ _id: 0, host: 'localhost:27017' }] })Attempts:
2 left
💡 Hint
Look for the official MongoDB command to start a replica set.
✗ Incorrect
The rs.initiate() command with the correct object specifying _id and members is the proper way to start a replica set.
❓ optimization
advanced2:00remaining
Improving read availability in a replica set
To improve read availability and reduce load on the primary, which configuration is best in a MongoDB replica set?
Attempts:
2 left
💡 Hint
Think about how to distribute read requests safely.
✗ Incorrect
Setting read preference to 'secondary' allows clients to read from secondary nodes, reducing load on the primary and improving availability.
🔧 Debug
expert3:00remaining
Diagnosing replica set member state
A secondary member in a MongoDB replica set is stuck in the 'RECOVERING' state and not becoming 'SECONDARY'. What is the most likely cause?
Attempts:
2 left
💡 Hint
Consider what 'RECOVERING' means for a secondary node.
✗ Incorrect
A secondary in 'RECOVERING' state is usually syncing data from the primary and will become 'SECONDARY' once caught up.