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().输出与db.printSecondaryReplicationInfo()相同。

Output输出

Example rs.printSecondaryReplicationInfo() output when run on a replica set with two secondary members:在具有两个辅助成员的副本集上运行时的rs.printSecondaryReplicationInfo()输出示例:

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 mongosh does not return JSON. mongosh中运行的rs.printSecondaryReplicationInfo()方法返回JSONUse rs.printSecondaryReplicationInfo() for manual inspection, and rs.status() in scripts.使用rs.printSecondaryReplicationInfo()进行手动检查,并在脚本中使用rs.status()

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.printSecondaryReplicationInfo() is run. rs.printSecondaryReplicationInfo()运行时,成员可能会在主文件后面显示负时间值。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.如果rs.printSecondaryReplicationInfo()在辅助服务器复制了一段时间不活动之后的写入之后运行,但在辅助服务器接收到来自具有最新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.要获取副本集的最新状态,请在主服务器上运行rs.printSecondaryReplicationInfo()

←  rs.printReplicationInfo()rs.printSlaveReplicationInfo() →