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

前端 未结 12 456
北荒
北荒 2020-12-12 10:03

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.

12条回答
  •  遥遥无期
    2020-12-12 10:23

    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...

提交回复
热议问题