MongoDB replica set Member states

In MongoDB each member of a replica set has a state so in this blog we can see about replica set member states & its explanation.

MongoDB replica set has three types of states.

  • Core states.
  • Other states.
  • Error states.

Core states :

In Core states has three members and all are eligible to vote in election.

  • PRIMARY.
  • SECONDARY.
  • ARBITER.

PRIMARY –

  • PRIMARY is the only member that can accept write operations.
  • A replica set has at most one primary at a time.

SECONDARY –

  • SECONDARY state replicate the primary’s data set & can be configured to accept read operations.
  • It may be elected to the PRIMARY state if the primary becomes unavailable.

ARBITER –

  • ARBITER state do not replicate data or accept write operations.
  • Replica sets should only have a member in the ARBITER state and exist solely participate in elections.

Other states :

In Other states has four members and all are eligible to vote in election expect STARTUP.

  • STARTUP.
  • STARTUP2.
  • RECOVERING.
  • ROLLBACK.

STARTUP –

  • Each member of a replica set start up in STARTUP state.
  • They are not yet a recognized member of any replica state.

STARTUP2 –

  • It has joined the set and is running an initial sync.

RECOVERING –

  • Either it perform startup self-checks or transition from completing a rollback or resync.
  • Data is not available for reads.

ROLLBACK –

  • The member is actively performing a rollback.

Error states :

In Error states has three members & all are not eligible to vote in election.

  • UNKNOWN.
  • DOWN.
  • REMOVED.

UNKNOWN –

  • Members that have never communicated status information to the replica set.

DOWN –

  • Members that lose their connection to the replica set & it’s an unreachable mode.

REMOVED –

  • Members that are removed from the replica set.

I hope this blog will help you find out MongoDB replica set member states.

Thank you !!

Published by arunkumarblog

RHCE Linux RedHat Certified Professionals,Working on MongoDB and MySQL Database Administrator.

Leave a comment

Design a site like this with WordPress.com
Get started