What is the default configuration file path for mongod

1,590 views
Skip to first unread message

Wyatt Biker

unread,
Jul 30, 2015, 8:34:12 AM7/30/15
to mongodb-user
I am just starting with MongoDB. So I know one can do this example to have mongod read the configuration file:

mongod --config /etc/mongod.conf


But is there a default location that mongod reads a configuration file from? If there is, what is it or how do I find out. I prefer not having to specify a --config parameter when I start mongod.

Also is there a mongo command to give me the current path of the db (or config file).

Thanks!

bala wagh

unread,
Jul 30, 2015, 9:26:57 AM7/30/15
to mongodb-user, wyatt...@gmail.com
have u checked in mongod.conf file for default file path...

sudo vi /etc/mongod.conf

Stephen Steneker

unread,
Jul 30, 2015, 8:54:25 PM7/30/15
to mongodb-user, wyatt...@gmail.com
On Thursday, 30 July 2015 22:34:12 UTC+10, Wyatt Biker wrote:
I am just starting with MongoDB. So I know one can do this example to have mongod read the configuration file:

mongod --config /etc/mongod.conf


But is there a default location that mongod reads a configuration file from? If there is, what is it or how do I find out. I prefer not having to specify a --config parameter when I start mongod.

Hi Wyatt,

There is no default configuration file baked into `mongod`. Typically you would start mongod via a service definition which would provide a config path that makes sense for your operating system conventions. For example, for Ubuntu this would be `/etc/mongod.conf` if you installed from the official MongoDB packages.

For more information, check the docs relevant to your install:
 
Also is there a mongo command to give me the current path of the db (or config file).

You can find the command line arguments and parsed values in the `mongo` shell using:
 db.serverCmdLineOpts()

For example, the current dbpath (if specified) would be:
 db.serverCmdLineOpts().parsed.storage.dbPath

The default dbpath is /data/db.

Regards,
Stephen

Wyatt Biker

unread,
Jul 31, 2015, 4:34:39 PM7/31/15
to mongodb-user, wyatt...@gmail.com, ste...@mongodb.com
Thanks for answering my questions!
Reply all
Reply to author
Forward
0 new messages