Docs HomeMongoDB Manual

rs.printSlaveReplicationInfo()

On this page本页内容

Definition定义

rs.printSlaveReplicationInfo()

Deprecated since version 4.4.1: Use rs.printSecondaryReplicationInfo() instead.

Returns a formatted report of the status of a replica set from the perspective of the secondary member of the set. 副本集secondary成员的角度返回副本集状态的格式化报告。The output is identical to that of db.printSlaveReplicationInfo().输出与db.printSlaveReplicationInfo()的输出相同。

Output输出

The following is example output from the rs.printSlaveReplicationInfo() method issued on a replica set with two secondary members:以下是在具有两个辅助成员的副本集上发出的rs.printSlaveReplicationInfo()方法的输出示例:

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

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.当主成员的不活动时间大于members[n].secondaryDelaySecs值时,延迟成员可能显示为比主成员晚0秒。

A member may show a negative time value behind the primary when rs.printSlaveReplicationInfo() is called. 当调用rs.printSlaveReplicationInfo()时,成员可能会在主后面显示负时间值。This behavior is expected if the method is called after a secondary replicates a write following a period of inactivity, but before it has received a heartbeat from the primary with its 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.辅助设备报告的滞后可能不能代表群集运行状况。负值并不表示辅助项领先于主项。

For the most up-to-date information on your replica set, it is generally advisable to run rs.printSlaveReplicationInfo() on the primary.要获得有关复制副本集的最新信息,通常建议在主服务器上运行rs.printSlaveReplicationInfo()