How can I tell where mongoDB is storing data? (its not in the default /data/db!)

171

My host came with a mongodb instance and there is no /db directory so now I am wondering what I can do to find out where the data is actually being stored.

This question is tagged with mongodb directory database

~ Asked on 2011-08-30 17:44:09

The Best Answer is


148

mongod defaults the database location to /data/db/.

If you run ps -xa | grep mongod and you don't see a --dbpath which explicitly tells mongod to look at that parameter for the db location and you don't have a dbpath in your mongodb.conf, then the default location will be: /data/db/ and you should look there.

~ Answered on 2011-09-02 18:00:14


60

What does your configuration file say?

$ grep dbpath /etc/mongodb.conf

If it is not correct, try this, your database files will be present on the list:

$ sudo lsof -p `ps aux | grep mongodb | head -n1 | tr -s ' ' | cut -d' ' -f 2` | grep REG

It's /var/lib/mongodb/* on my default installation (Ubuntu 11.04).

Note that there is also a /var/lib/mongodb/mongod.lock file holding mongod PID for convenience, however it is located in the data directory - which we are looking for...

~ Answered on 2011-08-30 17:53:43


Most Viewed Questions: