Docs Menu

rs.printSecondaryReplicationInfo()

On this page

  • Definition
  • Output
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().

Example rs.printSecondaryReplicationInfo() output when run on a replica set with two secondary members:

source: m1.example.net:27002
syncedTo: Mon Mar 01 2021 16:30:50 GMT-0800 (PST)
0 secs (0 hrs) behind the primary
source: m2.example.net:27003
syncedTo: Mon Mar 01 2021 16:30:50 GMT-0800 (PST)
0 secs (0 hrs) behind the primary
Note

The rs.printSecondaryReplicationInfo() method run in the mongo shell 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].slaveDelay 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.

On this page

Give Feedback
MongoDB logo
© 2021 MongoDB, Inc.

About

  • Careers
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2021 MongoDB, Inc.