OplogThread: Last entry no longer in oplog cannot recover! - Resyncing the Connector


mongo-connector 和 es同步数据时出现如下错误

mongo_connector.oplog_manager:202 - OplogThread: Last entry no longer in oplog cannot recover! Collection(Database(MongoClient(host=


可能需要

Resyncing the Connector



https://github.com/mongodb-labs/mongo-connector/wiki/Resyncing-the-Connector


This page describes when and how to re-sync mongo-connector. You'll need to do this if you see the error message Last entry no longer in oplog cannot recover!. The most common reason to need to re-sync mongo-connector is that it couldn't replicate operations from the oplog fast enough. This can happen when there is a lot of write activity happening in MongoDB, such as when using mongoimport. Because the oplog is a capped collection, older records are overwritten when the collection is full.

Avoiding Oplog Rollover

Mongo-connector can be more tolerant to short bursts of high write activity by increasing the oplog size in MongoDB. The greater oplog time allows mongo-connector to "catch up" when there is less write activity.

How to Perform a Re-Sync

The only way to ensure that the data in your external system is consistent with what is in MongoDB is to delete and re-index all documents in the target. After all data is removed, you may delete the oplog progress file (usually called "oplog.timestamp") and re-start mongo-connector. Mongo-connector will then perform a collection dump, re-indexing all your data. Be careful and double-check that you are deleting only and exactly what you mean to delete.

MongoDB

The simplest and fastest way to remove data from MongoDB is to drop the database:

mongo
> db.getSisterDB("<database name>").dropDatabase()
{ "dropped" : "<database name>", "ok" : 1 }

Or only drop a collection:

> db.getSisterDB("<database name>").<collection name>.drop()
true

Solr

You can remove all data by sending a GET request to a URL:

http://<hostname>:<port>/solr/<core name>/update?commit=true&stream.body=<delete><query>*:*</query></delete>

Elasticsearch

You can remove all data quickly and efficiently by deleting the index and re-creating it:

curl -XDELETE http://<hostname>:<port>/<index name>
curl -XPUT http://<hostname>:<port>/<index name>

After this, you should refresh the index to make these changes visible:

curl -XPOST http://<hostname>:<port>/<index name>/_refresh

Alternatives

There aren't any other methods to restore a consistent state with the source MongoDB replica set or cluster. However, you can get mongo-connector simply running again by deleting the oplog progress file and restarting mongo-connector. This causes mongo-connector to perform a collection dump, re-saving the latest versions of all documents, then start tailing the oplog. This does not bring your target to a consistent state but may be suitable for pure insert/update use cases. If any delete operations were clobbered by the oplog collection rollover, mongo-connector cannot catch them without a proper re-sync (described above)


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值