定义
rs.printReplicationInfo()Prints a formatted report of the replica set member's oplog. The displayed report formats the data returned by
db.getReplicationInfo(). The output ofrs.printReplicationInfo()is identical to that ofdb.printReplicationInfo().注意
The
rs.printReplicationInfo()method run inmongoshdoes not return JSON. Users.printReplicationInfo()for manual inspection, anddb.getReplicationInfo()in scripts.
输出示例
The following example is a sample output from the rs.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)
输出字段
rs.printReplicationInfo() formats and prints the data returned by db.getReplicationInfo():
- 配置的 oplog 大小
- 显示
db.getReplicationInfo().logSizeMB值。 - 从开始到结束的日志长度
- 显示
db.getReplicationInfo().timeDiff和db.getReplicationInfo().timeDiffHours值。 - oplog first event time
- 显示
db.getReplicationInfo().tFirst。 - oplog 上次事件时间
- 显示
db.getReplicationInfo().tLast。 - now
- 显示
db.getReplicationInfo().now。
有关数据的说明,请参阅db.getReplicationInfo() 。
兼容性
此方法可用于以下环境中托管的部署:
- MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
重要
This command is not supported in M0 and Flex clusters. For more information, see Unsupported Commands.
MongoDB Enterprise:基于订阅、自我管理的 MongoDB 版本
MongoDB Community:源代码可用、免费使用且可自行管理的 MongoDB 版本