Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check the current configuration of MongoDB

I've found documentation for the different configuration options, but how can I check which options are being used on a live system?

Is there a way to see which options were set, or at minimum which configuration file is being used?

like image 976
Matt Woelk Avatar asked Mar 27 '14 17:03

Matt Woelk


People also ask

Where can I find MongoDB config file?

dbPath is /var/lib/mongodb; this setting specifies where MongoDB should store its files. systemLog. path is /var/log/mongodb/mongod. log; this is the path where mongod will write its output.

How do I check my MongoDB status?

Following are some of the commands which can be used to get the status of Mongodb: service mongod status: Displays the status of MongodB service as like the screenshot given below. systemctl status mongod: Displays the same status of MongoDB service as like above command as shown in figure 1.

What is my current database MongoDB?

If you want to check your databases list, use the command show dbs. Your created database (mydb) is not present in list. To display database, you need to insert at least one document into it. In MongoDB default database is test.


2 Answers

Found the answer: https://stackoverflow.com/a/9361047/947305

There's a getCmdLineOpts command in the mongo shell. Run the following:

db._adminCommand( {getCmdLineOpts: 1}) 
like image 117
Matt Woelk Avatar answered Sep 21 '22 15:09

Matt Woelk


to get live settings, you can use

db.adminCommand({getParameter:"*"})

previously called _adminCommand with underscore in front, so if you have old mongo running, try that one.

https://docs.mongodb.com/manual/reference/command/getParameter/

like image 24
Lukas Liesis Avatar answered Sep 21 '22 15:09

Lukas Liesis