- Reference >
mongosh
Methods >- Replication Methods >
- rs.printSecondaryReplicationInfo()
rs.printSecondaryReplicationInfo()¶
On this page
Definition¶
-
rs.
printSecondaryReplicationInfo
()¶ Prints a formatted report of the replica set status from the perspective of the secondary member of the set. The output is identical to
db.printSecondaryReplicationInfo()
.
Output¶
Example rs.printSecondaryReplicationInfo()
output when run on a replica set with two secondary
members:
Note
The rs.printSecondaryReplicationInfo()
method run in mongosh
does
not return JSON. Use rs.printSecondaryReplicationInfo()
for manual inspection, and
rs.status()
in scripts.
A delayed member may show as 0
seconds behind the primary when the inactivity period on the primary is
greater than the members[n].secondaryDelaySecs
value.
A member may show a negative time value behind the primary when rs.printSecondaryReplicationInfo()
is run. This is expected if rs.printSecondaryReplicationInfo()
is run after a secondary replicates
a write that follows a period of inactivity, but before the secondary
receives a heartbeat from the primary with the latest optime.
Note
The lag reported by secondaries may not be representative of cluster health. Negative values do not indicate that the secondary is ahead of the primary.
To obtain the most current status for your replica set, run rs.printSecondaryReplicationInfo()
on the primary.