Definition定义
db.printSecondaryReplicationInfo()Prints a formatted report of the replica set status from the perspective of the secondary member of the set.从副本集的secondary成员的角度打印副本集状态的格式化报告。The output is identical to the输出与rs.printSecondaryReplicationInfo()method.rs.printSecondaryReplicationInfo()方法相同。
Compatibility兼容性
This method is available in deployments hosted in the following environments:此方法在以下环境中托管的部署中可用:
- MongoDB Atlas
: The fully managed service for MongoDB deployments in the cloud:云中MongoDB部署的完全托管服务
Important
This command is not supported in M0 and Flex clusters. For more information, see Unsupported Commands.M0和Flex集群不支持此命令。有关详细信息,请参阅不支持的命令。
- MongoDB Enterprise
: The subscription-based, self-managed version of MongoDB:MongoDB的基于订阅的自我管理版本 - MongoDB Community
: The source-available, free-to-use, and self-managed version of MongoDB:MongoDB的源代码可用、免费使用和自我管理版本
Output输出
Example 在具有两个次要成员的副本集上运行db.printSecondaryReplicationInfo() output when run on a replica set with two secondary members:db.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 在db.printSecondaryReplicationInfo() method run in mongosh does not return JSON. mongosh中运行的db.printSecondaryReplicationInfo()方法不返回JSON。Use 使用db.printSecondaryReplicationInfo() for manual inspection, and rs.status() in scripts.db.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 运行db.printSecondaryReplicationInfo() is run. This is expected if db.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.db.printSecondaryReplicationInfo()时,成员可能会在主节点后面显示负时间值。如果db.printSecondaryReplicationInfo()在辅助服务器复制了一段非活动期后的写入后运行,但在辅助服务器收到主服务器的最新优化心跳之前运行,则会出现这种情况。
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 要获取副本集的最新状态,请在主副本上运行db.printSecondaryReplicationInfo() on the primary.db.printSecondaryReplicationInfo()。