- Reference >
- Replica Set Status Reference
Replica Set Status Reference¶
On this page
The replSetGetStatus provides an overview of the
current status of a replica set. Issue the following command against
the admin database, in the mongo shell:
You can also use the following helper in the mongo shell to
access this functionality
The value specified (e.g 1 above,) does not impact the output of
the command. Data provided by this command derives from data included
in heartbeats sent to the current instance by other members of the
replica set: because of the frequency of heartbeats, these data can be
several seconds out of date.
Note
The mongod must have replication enabled and be a member
of a replica set for the for replSetGetStatus to
return successfully.
See also
“rs.status()” shell helper function,
“Replication”.
Fields¶
-
replSetGetStatus.set¶ The
setvalue is the name of the replica set, configured in thereplSetsetting. This is the same value as_idinrs.conf().
-
replSetGetStatus.date¶ The value of the
datefield is an ISODate of the current time, according to the current server. Compare this to the value of thelastHeartbeatto find the operational lag between the current host and the other hosts in the set.
-
replSetGetStatus.myState¶ The value of
myStatereflects state of the current replica set member. An integer between0and10represents the state of the member. These integers map to states, as described in the following table:Number Name State 0 STARTUPStart up, phase 1 (parsing configuration.) 1 PRIMARYPrimary. 2 SECONDARYSecondary. 3 RECOVERINGMember is recovering (initial sync, post-rollback, stale members.) 4 FATALMember has encountered an unrecoverable error. 5 STARTUP2Start up, phase 2 (forking threads.) 6 UNKNOWNUnknown (the set has never connected to the member.) 7 ARBITERMember is an arbiter. 8 DOWNMember is not accessible to the set. 9 ROLLBACKMember is rolling back data. See rollback. 10 SHUNNEDMember has been removed from replica set.
-
replSetGetStatus.members¶ The
membersfield holds an array that contains a document for every member in the replica set. See the “Member Statuses” for an overview of the values included in these documents.
-
replSetGetStatus.syncingTo¶ The
syncingTofield is only present on the output ofrs.status()on secondary and recovering members, and holds the hostname of the member from which this instance is syncing.
Member Statuses¶
-
replSetGetStatus.members.name¶ The
namefield holds the name of the server.
-
replSetGetStatus.members.self¶ The
selffield is only included in the document for the currentmongodinstance in the members array. It’s value istrue.
-
replSetGetStatus.members.errmsg¶ This field contains the most recent error or status message received from the member. This field may be empty (e.g.
"") in some cases.
-
replSetGetStatus.members.health¶ The
healthvalue is only present for the other members of the replica set (i.e. not the member that returnsrs.status.) This field conveys if the member is up (i.e.1) or down (i.e.0.)
-
replSetGetStatus.members.state¶ The value of the
statereflects state of this replica set member. An integer between0and10represents the state of the member. These integers map to states, as described in the following table:Number Name State 0 STARTUPStart up, phase 1 (parsing configuration.) 1 PRIMARYPrimary. 2 SECONDARYSecondary. 3 RECOVERINGMember is recovering (initial sync, post-rollback, stale members.) 4 FATALMember has encountered an unrecoverable error. 5 STARTUP2Start up, phase 2 (forking threads.) 6 UNKNOWNUnknown (the set has never connected to the member.) 7 ARBITERMember is an arbiter. 8 DOWNMember is not accessible to the set. 9 ROLLBACKMember is rolling back data. See rollback. 10 SHUNNEDMember has been removed from replica set.
-
replSetGetStatus.members.uptime¶ The
uptimefield holds a value that reflects the number of seconds that this member has been online.This value does not appear for the member that returns the
rs.status()data.
-
replSetGetStatus.members.optime¶ A document that contains information regarding the last operation from the operation log that this member has applied.
-
replSetGetStatus.members.optime.t¶ A 32-bit timestamp of the last operation applied to this member of the replica set from the oplog.
-
replSetGetStatus.members.optime.i¶ An incremented field, which reflects the number of operations in since the last time stamp. This value only increases if there is more than one operation per second.
-
-
replSetGetStatus.members.optimeDate¶ An ISODate formatted date string that reflects the last entry from the oplog that this member applied. If this differs significantly from
lastHeartbeatthis member is either experiencing “replication lag” or there have not been any new operations since the last update. Comparemembers.optimeDatebetween all of the members of the set.
-
replSetGetStatus.members.lastHeartbeat¶ The
lastHeartbeatvalue provides an ISODate formatted date of the last heartbeat received from this member. Compare this value to the value of thedatefield to track latency between these members.This value does not appear for the member that returns the
rs.status()data.
-
replSetGetStatus.members.pingMS¶ The
pingMSrepresents the number of milliseconds (ms) that a round-trip packet takes to travel between the remote member and the local instance.This value does not appear for the member that returns the
rs.status()data.