oplog.rs查看

发布时间 2023-11-16 10:33:20作者: slnngk

 

1.最早和最晚的数据保留情况

s1:PRIMARY> db.oplog.rs.find().sort({ts: 1}).limit(1)
{ "op" : "n", "ns" : "", "o" : { "msg" : "initiating set" }, "ts" : Timestamp(1699409857, 1), "v" : NumberLong(2), "wall" : ISODate("2023-11-08T02:17:37.103Z") }
s1:PRIMARY> db.oplog.rs.find().sort({ts: -1}).limit(1)
{ "op" : "n", "ns" : "", "o" : { "msg" : "periodic noop" }, "ts" : Timestamp(1700101522, 1), "t" : NumberLong(10), "v" : NumberLong(2), "wall" : ISODate("2023-11-16T02:25:22.662Z") }
s1:PRIMARY> 

 

最早时间
db.oplog.rs.find().sort({ts: 1}).limit(1)

最晚时间
db.oplog.rs.find().sort({ts: -1}).limit(1)