I'm having trouble finding if this is even a supported operation. I found things that suggest it didn't use to be, but I'm not getting any logs that indicate it's not supported (just confusing logs) and I wasn't able to find anything in mongo's docs that indicate it's not allowed.
For reference:
- OS: Centos6.6
- Mongod: v3.0.2
- Mongo Shell: v3.0.2
- Mongodump: v3.0.2
- Mongorestore: v3.0.2
Here's the command I'm running to create my dump (I am using auth):
mongodump -u username -p password --authenticationDatabase admin --oplog
Here's the original file structure after a dump.
└── dump
├── oplog.bson
├── admin
│ ├── system.users.bson
│ ├── system.users.metadata.json
│ ├── system.version.bson
│ └── system.version.metadata.json
├── dogs
│ ├── tails.bson
│ └── tails.metadata.json
└── mydata
├── objects.bson
├── objects.metadata.json
├── fs.chunks.bson
├── fs.chunks.metadata.json
├── fs.files.bson
├── fs.files.metadata.json
├── configuration.bson
└── configuration.metadata.json
I've tried a few different variations of restore to get what I want, but they each seem a little off. After reading the following in mongo's docs concerning mongorestore:
--db does not control which BSON files mongorestore restores. You must use the mongorestore path option to limit that restored data.
it seems to me that I should be able to copy the oplog.bson into the particular database's folder that I want to restore and then run the following from inside dump/:
mongorestore -u username -p password --authenticationDatabase admin --oplogReplay --db dogs dogs
I found this confusing because it gives these logs:
2015-05-13T22:10:12.694+0000 building a list of collections to restore from dogs dir
2015-05-13T22:10:12.695+0000 reading metadata file from dogs/tails.metadata.json
2015-05-13T22:10:12.695+0000 restoring dogs.oplog from file dogs/oplog.bson
2015-05-13T22:10:12.696+0000 no indexes to restore
2015-05-13T22:10:12.696+0000 finished restoring dogs.oplog
2015-05-13T22:10:12.696+0000 restoring dogs.tails from file dogs/tails.bson
2015-05-13T22:10:12.697+0000 restoring indexes for collection dogs.tails from metadata
2015-05-13T22:10:12.697+0000 finished restoring dogs.tails
2015-05-13T22:10:12.697+0000 replaying oplog
2015-05-13T22:10:12.697+0000 no oplog.bson file in root of the dump directory, skipping oplog application
2015-05-13T22:10:12.697+0000 done
The first part about dogs.oplog makes it seem as if things are working, however the later message about oplog confuses me.
No matter which variations of directories and paths that I try I can't seem to satiate this message in particular:
2015-05-13T22:10:12.697+0000 replaying oplog
2015-05-13T22:10:12.697+0000 no oplog.bson file in root of the dump directory, skipping oplog application
Does this mean my oplog replay isn't happening? Is my point-in-time backup / restore still doing what I expect? I recall seeing some tickets about improving the log messages of mongotools, perhaps this is just poor logging?