mongodb之oplog

1、查看master上当前的oplog状态:

>rs.printReplicationInfo()

configured oplog size: 5000MB
log length start to end: 587282secs (163.13hrs)
oplog first event time: Fri Dec 22 2017 20:10:57 GMT+0800 (CST)
oplog last event time: Fri Dec 29 2017 15:18:59 GMT+0800 (CST)
now: Fri Dec 29 2017 15:18:59 GMT+0800 (CST)

2、副本上查看

>db.getReplicationInfo()

"logSizeMB" : 5018.0009765625,
"usedMB" : 5037.85,
"timeDiff" : 588136,
"timeDiffHours" : 163.37,
"tFirst" : "Fri Dec 22 2017 18:09:22 GMT+0800 (CST)",
"tLast" : "Fri Dec 29 2017 13:31:38 GMT+0800 (CST)",
"now" : "Fri Dec 29 2017 13:31:38 GMT+0800 (CST)"

原文地址:https://www.cnblogs.com/cuishuai/p/8145549.html