03 / 11

What are replica set members?

The minimum recommended configuration for a replica set is a three member replica set with three data-bearing members: one primary and two secondary members.

The members of a replica set are:
  1. 1

    Primary

  2. 2

    Secondary

  3. 3

    Arbiter

Primary
  1. 1

    The primary is the only member that receives all write operations.

  2. 2

    MongoDB applies write operations on the primary and then records the operations on the primary's oplog. Secondary members replicate this log and apply the operations to their data sets.

  3. 3

    All members of the replica set can accept read operations. by default, an application directs its read operations to the primary member.

  4. 4

    The replica set can have at most one primary. [2] If the current primary becomes unavailable, an election determines the new primary.

Secondary
  1. 1

    Secondaries replicate operations from the primary to maintain an identical data set.

  2. 2

    To replicate data, a secondary applies operations from the primary's oplog to its own data set in an asynchronous process.

  3. 3

    A replica set can have one or more secondaries.

  4. 4

    Although clients cannot write data to secondaries, clients can read data from secondary members.

  5. 5

    A secondary can become a primary. If the current primary becomes unavailable, the replica set holds an election to choose which of the secondaries becomes the new primary.

Arbiter
  1. 1

    An arbiter participates in elections for primary but an arbiter does not have a copy of the data set and cannot become a primary.

  2. 2

    An arbiter has exactly 1 election vote. By default an arbiter has priority 0.

Difficulty: 5/10
Topics: replica set members, member roles, failover

Scenario Questions

0-2 years experience
  1. 1

    If you need to add a new secondary to an existing replica set to increase read capacity, what steps would you take and what role does that member play?

  2. 2

    During a simple deployment, you notice that one member is showing state PRIMARY while another shows SECONDARY. What does that tell you about the replica set members?

2-5 years experience
  1. 1

    Your application is experiencing intermittent read errors after a network partition. How would you investigate which replica set member is causing the issue?

  2. 2

    You need to reconfigure a replica set to add an arbiter without downtime. Explain why you would choose an arbiter and what impact it has on the member composition.

5-8 years experience
  1. 1

    At scale, you have a replica set spread across three data centers. How do you decide the distribution of voting members and secondaries to balance latency and fault tolerance?

  2. 2

    During a rolling upgrade, a secondary member fails to catch up and remains in RECOVERING state. What are the possible reasons related to its member configuration, and how would you resolve it?

8+ years experience
  1. 1

    Your organization is migrating from multiple independent replica sets to a sharded cluster with replica set shards. How would you plan the transition of member roles to ensure continuity and minimal impact on write availability?

  2. 2

    When designing a global multi‑region deployment, how would you leverage replica set member configurations (e.g., priority, hidden, delayed) to meet both low‑latency reads and disaster‑recovery requirements?

Follow-up Questions

  • What would happen if you removed the primary without re-electing a new one?
  • How does adding an arbiter affect write concern and election quorum?
  • Can you describe how member priority influences which node becomes primary?