rs.status()

Definition

  • rs.status()
  • Returns the replica set status from the point of view of the memberwhere the method is run. This method provides a wrapper around thereplSetGetStatus command.

This output reflects the current status of the replica set, usingdata derived from the heartbeat packets sent by the other membersof the replica set.

Output

For an example and details on the output, see replSetGetStatus.

Once the member completes its initial sync, thereplSetGetStatus.initialSyncStatus metrics becomesunavailable.

    • In earlier versions (3.4.x-4.2.0)
    • To return initial sync statusinformation, you must the replSetGetStatus commandwith the initialSync: 1 option on a secondary member or amember in STARTUP2 state:
  1. db.adminCommand( { replSetGetStatus: 1, initialSync: 1 } )

The replSetGetStatus.initialSyncStatus metrics remainsavailable after the member completes its initial sync. That is,you can run the replSetGetStatus command with theinitialSync: 1 on the secondary member to return its initialsync information.

You cannot specify initialSync: 1 in the mongoshell helper rs.status().