4

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?

RutledgePaulV
  • 2,568
  • 3
  • 24
  • 47
  • Do not nail me down on that, but iirc since you explicitly told to restore ` dogs` , the dogs directory of your dump becomes the root of the restore operation. So the oplog for dogs is adopted from the existing ` oplog.bson`, but since there is no file of such name under dogs, no replay happens for that file. – Markus W Mahlberg May 14 '15 at 13:47
  • I did copy the oplog.bson into the dogs directory first and still received the logs above – RutledgePaulV May 14 '15 at 14:07
  • 1
    Strange behaviour, but since the oplog reply from `dogs/oplog.bson` was reported to be successful, I wouldn't worry. You could inspect the oplog manually and check out wether the operations in there are applied – Markus W Mahlberg May 14 '15 at 14:17
  • Is the end result of this question "don't worry about that error message"? I'm seeing the same thing. – FilamentUnities Mar 18 '16 at 15:16
  • 1
    there already is one: https://jira.mongodb.org/browse/TOOLS-953 it's never been supported to use oplogReplay for anything but the full instance restore. – Asya Kamsky Mar 19 '16 at 07:21
  • 2
    and the oplog was not *replayed* it was restored - there is now an oplog collection in your dogs DB, which is not at all what you wanted. – Asya Kamsky Mar 19 '16 at 14:02

0 Answers0