Restore a mongo DB from a compose.io backup?
Asked Answered
B

1

13

If you download a compose.io backup of a mongodb instance and uncompress the .tar file you end up with .ns and extensions that are single digits. How do you restore the db from these?

Benoit answered 3/1, 2016 at 0:7 Comment(0)
B
16

The .ns .0 .1 etc. files are the data files themselves.

This the raw db you can mongodump those files and then mongorestore as always:

This solution would work pre mongo 3.0, but --dbpath is no longer supported by mongodump.

Mongo 3.0 Solution:

  1. Run mongod --dbpath ./ from the directory with the extracted download with the .ns files.
  2. Run mongodump -d [DBNAME] -o [DIR TO DUMP TO] ...options are not required.
  3. Proceed with a mongorestore as normal
Benoit answered 3/1, 2016 at 0:7 Comment(3)
I've got a post here explaining how to do this in detail: dhariri.com/posts/570275fed1befa596a80bba2Dudeen
So what would be the solution for MongoDB 3.x?Galvin
@Galvin The above solution worked for Mongo 3.4.Elgon

© 2022 - 2024 — McMap. All rights reserved.