MongoDB 101 Tips – How to view current configuration on a running system

MongoDB 101 Tips – How to view current configuration on a running system

Imagine you are a DBA managing a MongoDB environment. And you want to view the current configuration of a running system. Equivalent to the following;

  • PostgreSQL => show all;
  • Oracle => show parameters;

In MongoDB, it is not as straightforward. You have to know what you want to look for exactly. The entire database configuration is not in a single place.

  • To get the configuration file that the current MongoDB instance is using, use “db.serverCmdLineOpts();”
  • To get the current server parameters, use “db.runCommand( { getParameter : ‘*’ } )” against the admin database in any replica set
  • To get the sharding configuration, run “sh.status()” against a mongos server.
  • To get about the replica sets information, use “rs.status()” against the primary replica set

However, it is not possible to have a similar “show all” command in MongoDB to list what is the exact configurations that the MongoDB instance is running at that point of time. Thus, it would be ideal when you start mongod process with –config parameter rather than passing it as an argument for operation reasons.

Lastly, it is almost necessary to restart the mongod process after any configuration changes. The only run-time configuration that you can change is below, which is pretty darn short.

 -failIndexKeyTooLong
 -notablescan
 -logComponentVerbosity
 -logLevel
 -logUserIds
 -quiet
 -traceExceptions
 -replApplyBatchSize
 -replIndexPrefetch
 -auditAuthorizationSuccess
 -clusterAuthMode
 -scramIterationCount
 -sslMode
 -userCacheInvalidationIntervalSecs
 -journalCommitInterval
 -syncdelay
 -wiredTigerEngineRuntimeConfigSetting
 -disableJavaScriptJIT

Reference:

 

Regards,
Wei Shan

 

Advertisements
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: