Search code examples
mongodbmongodump

mongodump with replica set with oplog throws error: "oplog mode is only supported on full dumps"


I have a replica set with 3 members. Each one is running mongod 2.4.8 on Linux. I am using MMS agent to monitor the health of my replicaset/hosts and all appears ok.

I am using mongodump to backup my dbs & can do a successful dump if I don't use the --oplog switch, like this:

mongodump -v --db "mydb" --out /backups

However, as I am backing up live db's I want to use the --oplog switch. So I have modified my command to include the --oplog switch and specify my replica set in the --hosts switch:

mongodump -v --oplog --host myrepset/m1:27017,m2:27017,m3:27017 --db "mydb" --out /backup

However, this command fails with this error: oplog mode is only supported on full dumps

This is apparently the same error that would be thrown when trying to use the --oplog switch on a single instance.

I have read the mongo tutorials & reference pages, but don't understand what I am doing wrong. http://docs.mongodb.org/manual/reference/program/mongodump/

Any help much appreciated.


Solution

  • The --oplog option for mongodump is for full dumps, not for those specifying an individual database. In order to run it you'll need to remove the --db "mydb" from the mongodump command.