Definition定义
db.getReplicationInfo()Returns a document with the status of the replica set, using data polled from the oplog. Use this output when diagnosing issues with replication.使用从oplog轮询的数据返回具有副本集状态的文档。在诊断复制问题时使用此输出。
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部署的完全托管服务
Note
This command is supported in all MongoDB Atlas clusters. 所有MongoDB Atlas集群都支持此命令。For information on Atlas support for all commands, see Unsupported Commands.有关Atlas支持所有命令的信息,请参阅不支持的命令。
- 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输出
db.getReplicationInfo().logSizeMBReturns the total size of the oplog in megabytes. This refers to the total amount of space allocated to the oplog rather than the current size of operations stored in the oplog.返回oplog的总大小(MB)。这是指分配给oplog的总空间量,而不是oplog中存储的操作的当前大小。The oplog can grow past its configured size limit to avoid deleting theoplog可以超过其配置的大小限制,以避免删除多数提交点。majority commit point.
db.getReplicationInfo().usedMBReturns the total amount of space used by the oplog in megabytes. This refers to the total amount of space currently used by operations stored in the oplog rather than the total amount of space allocated.返回oplog使用的总空间量(MB)。这是指oplog中存储的操作当前使用的空间总量,而不是分配的空间总量。
db.getReplicationInfo().errmsgReturns an error message if there are no entries in the oplog.如果oplog中没有条目,则返回错误消息。
db.getReplicationInfo().oplogMainRowCountOnly present when there are no entries in the oplog. Reports the number of items or rows in the oplog (e.g.仅当oplog中没有条目时才显示。报告oplog中的项目或行数(例如0).0)。
db.getReplicationInfo().timeDiffReturns the difference between the first and last operation in the oplog, represented in seconds.返回oplog中第一个和最后一个操作之间的差值,以秒表示。Only present if there are entries in the oplog.仅当oplog中有条目时才显示。
db.getReplicationInfo().timeDiffHoursReturns the difference between the first and last operation in the oplog, rounded and represented in hours.返回oplog中第一个和最后一个操作之间的差值,四舍五入并以小时表示。Only present if there are entries in the oplog.仅当oplog中有条目时才显示。
db.getReplicationInfo().tFirstReturns a timestamp for the first (i.e. earliest) operation in the oplog. Compare this value to the last write operation issued against the server.返回oplog中第一个(即最早的)操作的时间戳。将此值与对服务器发出的最后一次写入操作进行比较。Only present if there are entries in the oplog.仅当oplog中有条目时才显示。
db.getReplicationInfo().tLastReturns a timestamp for the last (i.e. latest) operation in the oplog. Compare this value to the last write operation issued against the server.返回oplog中最后一次(即最新一次)操作的时间戳。将此值与对服务器发出的最后一次写入操作进行比较。Only present if there are entries in the oplog.仅当oplog中有条目时才显示。
db.getReplicationInfo().nowReturns a timestamp that reflects the current time.返回反映当前时间的时间戳。The shell process generates this value, and the datum may differ slightly from the server time if you're connecting from a remote host as a result. Equivalent toshell进程生成此值,如果因此从远程主机连接,则数据可能与服务器时间略有不同。相当于Date().Date()。Only present if there are entries in the oplog.仅当oplog中有条目时才显示。