Last updated on March 3rd, 2022 at 05:01 pm

Mongodb is a document based database. It doesn’t have Rows & Tables like RDMS instead they have Documents and Collections.

For finding where the data (dbpath), logpath and pidpath in MongoDB running on a linux environment,First we need to figure out where the mongod.conf file is located. Use the command below

[root@myserver~]# ps -ef|grep mongo 
mongod 15427 1 0 17:38 ? 00:00:00 /usr/bin/mongod -f /etc/mongod.conf
[root@myserver~]#

Use VI editor or CAT command to see the content of the mongod.conf file.

#where to log
logpath=/var/log/mongodb/mongod.log
 
dbpath=/var/lib/mongo
 
# location of pidfile
pidfilepath=/var/run/mongodb/mongod.pid

logpath will give you the log file location.

dbpath will give you the location where data is stored

pidfilepath will have the process id file location.

There are also other also other configuration values inside this conf file.

You can also change dbpath using the option –dbpath.

Leave a Reply

Your email address will not be published. Required fields are marked *