3

In the mongodb documentation for the configuration options it says that I can specify how much RAM index building will consume:

maxIndexBuildMemoryUsageMegabytes: Limits the amount of memory that simultaneous foreground index builds on one collection may consume for the duration of the builds.

This setting is set after starting the server by executing an administrative command called setParameter. This is done like this:

mongo --eval "db.adminCommand({setParameter: 1, maxIndexBuildMemoryUsageMegabytes: 700})"

I would like to specify this amount when the server starts up by putting it in the Configuration File Options. The documentation does not seem to include this option.

How can I specify this setting from the mongod.conf file?

1 Answer 1

4

The different approaches for configuring setParameter options (via runtime admin command, config file setting, or command-line option) are listed in the Synopsis section at the top of the MongoDB Server Parameters page you referenced.

You can use setParameter key/value pairs in the YAML configuration file.

For example:

setParameter:
    maxIndexBuildMemoryUsageMegabytes: 700

To confirm this setting has taken effect via the mongo shell, use either of:

// Check the parameter values parsed from config file or command-line options
db.serverCmdLineOpts().parsed.setParameter

// Check the current setting of the maxIndexBuildMemoryUsageMegabytes parameter 
db.adminCommand({getParameter: 1, maxIndexBuildMemoryUsageMegabytes: 1})

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.