How to check the current configuration of MongoDB

2020-05-25 03:50发布

问题:

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?

回答1:

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})


回答2:

to get live settings, you can use

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

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