Mongodb – How to access the data of collections from the .ns and other core storage files in mongodb

mongodb

My database in MongoDB was not accessible after the journal file became of the size > 1 GB . So I restarted the mongod process with a different data path to store the mongodb files in my machine.
Now I want to recover my old data from the old path but I am unable to do so. Can anyone help?

The DB is on a 64 bit Ubuntu box.

Best Answer

Check this guide: http://docs.mongodb.org/manual/tutorial/backup-with-mongodump/ Create Backups Without a Running mongod Instance

If your MongoDB instance is not running, you can use the --dbpath option to specify the location to your MongoDB instance’s database files. mongodump reads from the data files directly with this operation. This locks the data directory to prevent conflicting writes. The mongod process must not be running or attached to these data files when you run mongodump in this configuration.

mongodump --dbpath /old_data -o dataout

Then restore to a new data-directory and access the databases.