question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mongo connector is lag behind mongodb

See original GitHub issue

Hi guys, We are using mongo-connector to feed data from mongodb to elasticsearch. Everything went well until today we have a big insert / update to mongodb and mongo-connector started falling behind and taking hours to catch-up. Here is the mongo-connector config:

"mainAddress": "10.a.b.c:27017",
    "oplogFile": "/var/log/mongo-connector/oplog.timestamp",
    "noDump": false,
    "batchSize": -1,
    "verbosity": 2,
    "continueOnError": true,

 "docManagers": [
        {
            "docManager": "elastic2_doc_manager",
            "targetURL": "10.x.y.z:9200",
            "bulkSize": 1000,
            "__uniqueKey": "_id",
            "args": {
                "clientOptions": {"timeout": 60}
                 }
        }

Elasticsearch is setup as cluster of 3 servers. I’m looking for anyway to make mongo-connector tailing and update data faster.

Thanks everyone.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:42 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
sliwinski-miloszcommented, Jul 21, 2016

Good to hear! 😃 Thank you for your patience. Now it is time to prepare some tests and make a pull request. I will do that soon.

3reactions
jmmkcommented, Jun 17, 2016

@luisobo @behackett I have been out of town for a few weeks, but I will try and see if I tidy up my solution and make an upstream PR.

@luisobo it’s not just the upserts that can/should be batched, it’s every operation. ElasticSearch allows a “bulk indexing operation” with any number of inserts/updates/deletes that will be run in the order specified (see: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html).

Mongo Connector is just passing each oplog operation to the doc manager to handle it however it sees fit. In order to properly replicate the database state, the operations must be run “one at a time” in the exact order they happened. So if Mongo Connector tried to do any batching logic, it may not be correct for how the downstream data store needs to handle the operations. But since we know we can batch them in a bulk indexing request and that they will be run in order, we can do that for ES to prevent unnecessary network calls.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mongo Replica Lag Falls behind - - Replication - MongoDB
I have a mongo cluster that has the same hardware across 3 servers. It is currently set to Master, Secondary Secondary, and the...
Read more >
How to find the cause of replication lag on a particular ...
I have one more thought about this: replication lag was typically caused because the secondary cannot process the incoming writes fast enough, ...
Read more >
Troubleshoot Replica Sets — MongoDB Manual
Replication lag can be a significant issue and can seriously affect MongoDB replica set deployments. Excessive replication lag makes "lagged" members ...
Read more >
Replication Lag on Secondary in 3 node mongodb Cluster
Hi Mongo DB Team, We have a 3-node MongoDB Replication cluster with mongo version ... servers is lag behind the primary (sometimes 2-5...
Read more >
Replication lag for more than 10 hours - MongoDB
Your insert operation is asking for WriteConcern: “majority”, and it has a timeout of 15 seconds, meaning if the system can't write to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found