02 / 11

What is Replica Set?

Difficulty: 5/10
replication, high availability, failover

A replica set in MongoDB is a group of mongod processes that maintain the same data set.

  1. 1

    Each replica set node must belong to one, and only one, replica set. Replica set nodes cannot belong to more than one replica set.

  2. 2

    A replica set contains several data bearing nodes and optionally one arbiter node. Of the data bearing nodes, one and only one member is deemed the primary node, while the other nodes are deemed secondary nodes.

Scenario Questions

0-2 years experience

  1. 1If you need to add a secondary node to an existing replica set to improve read capacity, what steps would you take?
  2. 2What happens to client reads when the primary of a replica set goes down and you have readPreference set to 'primaryPreferred'?
  3. 3How would you configure a replica set with three members to ensure automatic failover?

2-5 years experience

  1. 1We observed occasional stale reads after a primary stepdown. Can you walk me through why that might happen and how you'd mitigate it?
  2. 2During a deployment, writes started failing with a 'not master' error. How would you troubleshoot the replica set state?
  3. 3Explain the trade‑offs between using an even number of voting members versus an odd number in a replica set.

5-8 years experience

  1. 1Design a strategy to scale read traffic across a geographically distributed replica set while keeping write latency low.
  2. 2How would you handle a scenario where a secondary falls behind the oplog and cannot catch up, affecting your backup strategy?
  3. 3Discuss the impact of write concern and read concern settings on data consistency and availability in a replica set under network partitions.

8+ years experience

  1. 1We need to migrate a legacy monolithic application using a single MongoDB instance to a sharded cluster with replica sets. What architectural considerations around replica set configuration would you prioritize?
  2. 2How would you design a cross‑region disaster recovery plan using replica sets, considering latency, failover time, and operational overhead?
  3. 3When multiple teams share the same replica set, what governance and configuration policies would you put in place to avoid conflicts and ensure stability?

Follow-up Questions

  • Can you walk me through the election process when the primary steps down?
  • What metrics would you monitor to detect replica set health issues early?
  • How would your solution differ if you had an even number of voting members?
Share

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.