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

db.printReplicationInfo()(mongosh方法)

db.printReplicationInfo()

打印副本集成员oplog的格式化报告。 显示的报告对db.getReplicationInfo()返回的数据进行格式化。

The output of db.printReplicationInfo() is identical to that of rs.printReplicationInfo().

注意

The db.printReplicationInfo() method run in mongosh does not return JSON. Use db.printReplicationInfo() for manual inspection, and db.getReplicationInfo() in scripts.

The following example is a sample output from the db.printReplicationInfo() method run on the primary:

configured oplog size: 192MB
log length start to end: 65422secs (18.17hrs)
oplog first event time: Mon Jun 23 2014 17:47:18 GMT-0400 (EDT)
oplog last event time: Tue Jun 24 2014 11:57:40 GMT-0400 (EDT)
now: Thu Jun 26 2014 14:24:39 GMT-0400 (EDT)

db.printReplicationInfo() formats and prints the data returned by db.getReplicationInfo():

配置的 oplog 大小

显示db.getReplicationInfo().logSizeMB值。

从开始到结束的日志长度

显示db.getReplicationInfo().timeDiffdb.getReplicationInfo().timeDiffHours值。

oplog first event time

显示db.getReplicationInfo().tFirst

oplog 上次事件时间

显示db.getReplicationInfo().tLast

now

显示db.getReplicationInfo().now

有关数据的说明,请参阅db.getReplicationInfo()

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

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

注意

所有 MongoDB Atlas 集群都支持此命令。有关 Atlas 对所有命令的支持的信息,请参阅不支持的命令

给本页内容打分

在此页面上