getReplicationInfo()
This method returns a document with the status of the replica set, using data polled from the oplog.
Note: Use this output when diagnosing issues with replication.
Syntax:
db.getReplicationInfo()
Example 1: When replication is detected
MongoDB
db.getReplicationInfo()
Output
{"logSizeMB": 694.33,"usedMB": 28.6,"timeDiff": 2152896,"timeDiffHours": 598.03,"tFirst": "Sat Jun 25 2022 17:48:27 GMT+0530 (IST)","tLast": "Sat Jun 15 2022:50:03 GMT+0530 (IST)","now": "Sun Jun 25 2022 15:50:09 GMT+0530 (IST)"}
Example 2: When no replication detected
MongoDB
db.getReplicationInfo()
Output:
{ "errmsg" : "replication not detected" }
No comments:
Post a Comment