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

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

Asked on January 3, 2019 in MongoDB.
Add Comment


  • 3 Answer(s)

    the default database location of mongod is /data/db/.

    The following statement you will be follow, 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 January 3, 2019.
    Add Comment

    The configuration file is say what ?

    $ grep dbpath /etc/mongodb.conf
    
    

    just you want to try this one, 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 my default installation of (Ubuntu 11.04) /var/lib/mongodb/*

    Notice :for that /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 January 3, 2019.
    Add Comment

    You can try the newer version of mongodb v2.6.4

    grep dbpath /etc/mongod.conf
    
    

    you will get like this

    dbpath=/var/lib/mongodb
    
    

    The data is where to stored

    Answered on January 3, 2019.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.