Docs HomeMongoDB Manual

db.getReplicationInfo()

On this page本页内容

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轮询的数据返回具有副本集状态的文档。在诊断复制问题时使用此输出。

Output输出

db.getReplicationInfo().logSizeMB

Returns the total size of the oplog in megabytes. 返回oplog的总大小(MB)。This refers to the total amount of space allocated to the oplog rather than the current size of operations stored in the oplog.这是指分配给操作日志的空间总量,而不是存储在操作日志中的操作的当前大小。

The oplog can grow past its configured size limit to avoid deleting the majority commit point.oplog可以超过其配置的大小限制,以避免删除多数提交点

db.getReplicationInfo().usedMB

Returns 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.

db.getReplicationInfo().errmsg

Returns an error message if there are no entries in the oplog.

db.getReplicationInfo().oplogMainRowCount

Only present when there are no entries in the oplog. Reports the number of items or rows in the oplog (e.g. 0).

db.getReplicationInfo().timeDiff

Returns the difference between the first and last operation in the oplog, represented in seconds.

Only present if there are entries in the oplog.

db.getReplicationInfo().timeDiffHours

Returns the difference between the first and last operation in the oplog, rounded and represented in hours.

Only present if there are entries in the oplog.

db.getReplicationInfo().tFirst

Returns a timestamp for the first (i.e. earliest) operation in the oplog. Compare this value to the last write operation issued against the server.

Only present if there are entries in the oplog.

db.getReplicationInfo().tLast

Returns a timestamp for the last (i.e. latest) operation in the oplog. Compare this value to the last write operation issued against the server.

Only present if there are entries in the oplog.

db.getReplicationInfo().now

Returns 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 to Date().

Only present if there are entries in the oplog.