对于 AI 代理:可在 https://www.mongodb.com/zh-cn/docs/llms.txt 获取文档索引—通过在任何 URL 路径后添加 .md 可获取所有页面的 Markdown 版本。
Docs 菜单

rs.printSecondaryReplicationInfo()(mongosh方法)

rs.printSecondaryReplicationInfo()

从副本集的从节点成员的角度打印副本集状态的格式化报告。 输出与db.printSecondaryReplicationInfo()相同。

此方法可用于以下环境中托管的部署:

  • MongoDB Atlas :用于在云中部署MongoDB 的完全托管服务

重要

M0 和 Flex 集群不支持此命令。有关更多信息,请参阅不支持的命令。

在具有两个从节点(secondary node from replica set)成员的副本集上运行时的 rs.printSecondaryReplicationInfo() 输出示例:

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 '
}

当主节点上的不活动时段大于 members[n].secondaryDelaySecs 值可能会显示为落后于主节点 0 秒。

A member may show a negative time value behind the primary when rs.printSecondaryReplicationInfo() is run. 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.

注意

从节点报告的延迟可能无法代表集群的运行状况。 负值并不表示从节点领先于主节点。

要获取副本集的最新状态,请在主节点 (primary node in the replica set)上运行rs.printSecondaryReplicationInfo()。

给本页内容打分

在此页面上