rs.printSlaveReplicationInfo()

Definition

Output

The following is example output from thers.printSlaveReplicationInfo() method issued on a replica setwith two secondary members:

  1. source: m1.example.net:27017
  2. syncedTo: Thu Apr 10 2014 10:27:47 GMT-0400 (EDT)
  3. 0 secs (0 hrs) behind the primary
  4. source: m2.example.net:27017
  5. syncedTo: Thu Apr 10 2014 10:27:47 GMT-0400 (EDT)
  6. 0 secs (0 hrs) behind the primary

A delayed member may show as 0seconds behind the primary when the inactivity period on the primary isgreater than the members[n].slaveDelayvalue.

A member may show a negative time value behind the primary whenrs.printSlaveReplicationInfo() is called. This behavior isexpected if the method is called after a secondary replicates a writefollowing a period of inactivity, but before it has received aheartbeat from the primary with its latest optime.

Note

The lag reported by secondaries may not be representative of clusterhealth. Negative values do not indicate that the secondary is aheadof the primary.

For the most up-to-date information on your replica set, it isgenerally advisable to runrs.printSlaveReplicationInfo() on the primary.