简体   繁体   English

为什么mongodb oplog总是为空?

[英]Why mongodb oplog is always empty?

I'm trying to write synchronizer between MongoDB and Lucene. 我正在尝试在MongoDB和Lucene之间编写同步器。 Idea is to implement application that will tail oplog and reproduce everything in Lucene. 想法是实现将终止oplog并在Lucene中重现所有内容的应用程序。 As a basis I'm using this post 作为基础,我正在使用这篇文章

The problem is that my oplog is always empty: 问题是我的oplog总是空的:

rs0:PRIMARY> db.oplog.rs.find({},{"ts":1}).sort({$natural: -1}).hasNext()
false

rs0:PRIMARY> db.Message.find({}).count()
729

rs0:PRIMARY> db.oplog.rs.find({}).hasNext()
false

rs0:PRIMARY> db.oplog.rs.find()
rs0:PRIMARY> 

Can someone explain me what I'm doing wrong? 有人可以解释我在做什么吗?

All replica set members contain a copy of the oplog, in the local.oplog.rs collection. 所有副本集成员都在local.oplog.rs集合中包含操作日志的副本。 In order to query the oplog you have to use the local database . 为了查询操作日志,您必须使用本地数据库

use local;
db.oplog.rs.find();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM