定义
db.printSecondaryReplicationInfo()从副本集的从节点成员的角度打印副本集状态的格式化报告。 输出与
rs.printSecondaryReplicationInfo()方法相同。
兼容性
此方法可用于以下环境中托管的部署:
- MongoDB Atlas:用于云中 MongoDB 部署的完全托管服务
重要
M0 和 Flex 集群不支持此命令。有关更多信息,请参阅不支持的命令。
MongoDB Enterprise:基于订阅、自我管理的 MongoDB 版本
MongoDB Community:源代码可用、免费使用且可自行管理的 MongoDB 版本
输出
Example db.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)', replLag: '0 secs (0 hrs) behind the primary ' } --- source: m2.example.net:27003 { syncedTo: 'Mon Mar 01 2021 16:30:50 GMT-0800 (PST)', replLag: '0 secs (0 hrs) behind the primary ' }
注意
The db.printSecondaryReplicationInfo() method run in mongosh does not return JSON. Use db.printSecondaryReplicationInfo() for manual inspection, and rs.status() in scripts.
当主节点上的不活动时段大于 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.
注意
从节点报告的延迟可能无法代表集群的运行状况。 负值并不表示从节点领先于主节点。
To obtain the most current status for your replica set, run db.printSecondaryReplicationInfo() on the primary.