2

What is a easy way to do the initial sync between mongodb and elasticsearch. I use the https://github.com/richardwilly98/elasticsearch-river-mongodb to sync any updates. The river works by tracking the changes in the mongodb replica set logs and applying those to ES but how can I sync what is already in mongodb to elasticsearch.

A proposed solution I have seen is to dump ( mongodump) the data and restore ( mongorestore ) but not sure of its impact on a live mongo database.

1 Answer 1

1

That is actually the solution. mongodump -u root -p 'yourpassword' --oplog the oplog will also copy the transaction log which I think is required for your script to work. after that you do mongorestore on the otherside mongorestore --oplogReplay

Also another solution is to use "OplogReplay" script instead of the one you are using This script does the initial sync from source to destination automatically when you run it for the first time https://pypi.python.org/pypi/OplogReplay/ I recommend that you download the latest code from github directly https://github.com/uberVU/mongo-oplogreplay

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.