百度智能云

All Product Document

          Cloud Database MONGODB

          Best practices for MongoDB parameter configuration

          When users use Mongodb products, sometimes they need to set the parameters of Mongodb components according to business requirements. In order to facilitate users to change the parameters, this article will introduce the best practices of parameter configuration and modification in detail.

          Best practices for parameter configuration

          Introduction to the meaning, optional values and default values of parameters:

          Parameter Meaning Optional Value Default Value
          net_compression_compressors default compression program for communication between Mongod or Mongos instances snappy, disabled, zlib(≥3.6 available) disabled(3.4), snappy (3.6, 4.0)
          net_serviceExecutor determine the thread and execution model used by mongos to execute client requests (≥3.6 available) synchronous, adaptive adaptive(Mongos), synchronous(Shard/Config)
          operationProfiling_mode specify which operations mongodb should analyze off, slowOp, all off
          operationProfiling_slowOpThresholdMs slow operation time threshold (milliseconds), operations with longer running time than this threshold are considered as slow natural numbers[0-65536] 100
          replication_enableMajorityReadConcern whether support the read concern of majority level, if true, support; if false, not support, or called committed reads false, true false
          setParameter_cursorTimeoutMillis set idle cursor cache expiration time (milliseconds) natural numbers [1-2147483647] 600000(i.e. 10min)
          setParameter_internalQueryExecMaxBlockingSortBytes set the maximum data amount (bytes, b) returned by the sort statement when the index cannot be used natural numbers [33554432-268435456] 33554432(i.e. 32MB)

          Replica set parameter configuration

          After the replica set instance is successfully created, you can see the default parameters of the instance, list of which is as follows:

          image.png

          If you need to modify the configuration, you can click Modify Parameters to call out the modification interface, as shown in the following figure:

          image.png

          For example, if we need to modify operationProfiling_mode和operationProfiling_slowOpThresholdMs,after modifying the following two items, click the "OK" button:

          Then we will enter the "parameter modifying" interface, instance will be restarted during this process, we have to wait for the parameter modification to be completed:

          When the cluster status returns to the "Running" status again, it indicates that the modification of parameters has been completed, the modification status of parameters can be viewed through the latest list.

          Shard set parameter configuration

          The parameter list of the shard set is as follows:

          The parameter list of shard set is basically the same as that of the replica set, only the modifiable parameters are different in different components, which can be modified by selecting multiple components of the same type. If we need to modify the parameters of Mongos, first click on the "Mongos" tab and select the Mongos component we need to modify. If we need to modify the parameters of all Mongos components, we can operate as per the following figure:

          Check all Mongos components, then click the "Parameter Modification" button, the following modification page then pops up and shows the list of parameters to be modified and the list of nodes to be modified, the interface is as follows:

          Click "OK" button to start parameter modification, then we will enter the state of "Parameter Modification", as shown in the following figure:

          Refresh the page to view the latest status. When the status changes back to "Running" again, the reconfiguration is completed and the two parameters change as the revised target values.。

          Previous
          Best practices for use of MongoDB
          Next
          API Reference