1

Mongo version is 3.0.6, I have a process to apply oplog from another database to destination database by mongodump and mongorestore by using --oplogReplay option.

But I found duplicate key error messages many time, source and target database have the same structure (indies and fields) that is impossible to have duplicated record on target because it should be error on source db first.

And error message looks like this

2017-08-20T00:55:55.900+0000    Failed: restore error: error applying oplog: applyOps: exception: E11000 duplicate key error collection: <collection_name> index: <field> dup key: { : null }

And today I found a mystery message like this

2017-08-25T01:02:14.134+0000    Failed: restore error: error applying oplog: applyOps: not master

What's a mean? And my understanding, mongorestore has "--stopOnError" option that means the default process, if have any errors, the restore process will skip and move on. But I got above error and then the restore process has been terminated anytime. :(

tao hiko
  • 113
  • 1
  • 11
  • The second error, I found the root cause that is out-of-memory of MongoDB and then replication service switch to another node to be Primary because there have many sessions in a database during restoring. The workaround, I paused others session and restore again. – tao hiko Sep 06 '17 at 06:57

1 Answers1

0

This does not answer directly to your question, sorry for that, but...

If you need to apply oplog changes for database A to database B, it would be better to use mongo-connector program, than mongodump/mongorestore -pair.

JJussi
  • 1,540
  • 12
  • 12
  • It still uses Oplog and I'm not sure what is different between mongo-connector and mongorestore to apply Oplog on destination database but I will try it. Thank you. – tao hiko Sep 06 '17 at 07:00