On this page本页内容
rs.
status
()¶Returns the replica set status from the point of view of the member where the method is run. This method provides a wrapper around the replSetGetStatus
command.
This output reflects the current status of the replica set, using data derived from the heartbeat packets sent by the other members of the replica set.
For an example and details on the output, see replSetGetStatus.
If you run mongo
shell helper rs.status()
(or the replSetGetStatus
command) on a member during its initial sync (i.e. STARTUP2
state), the command returns replSetGetStatus.initialSyncStatus
metrics.
Once the member completes its initial sync, the replSetGetStatus.initialSyncStatus
metrics becomes unavailable.
To return initial sync status information, you must the replSetGetStatus
command with the initialSync: 1
option on a secondary member or a member in STARTUP2
state:
The replSetGetStatus.initialSyncStatus
metrics remains available after the member completes its initial sync. That is, you can run the replSetGetStatus
command with the initialSync: 1
on the secondary member to return its initial sync information.
You cannot specify initialSync: 1
in the mongo
shell helper rs.status()
.