.. _server-parameters: ======================================================= MongoDB Server Parameters for a Self-Managed Deployment ======================================================= .. default-domain:: mongodb .. facet:: :name: genre :values: reference .. contents:: On this page :local: :backlinks: none :depth: 2 :class: singlecol .. include:: /includes/LDAP-deprecated.rst Synopsis -------- MongoDB provides a number of configuration options that you can set using: - the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, : } ) - the :setting:`setParameter` configuration setting: .. code-block:: yaml setParameter: : ... - the ``--setParameter`` command-line option for :option:`mongod ` and :option:`mongos `: .. code-block:: bash mongod --setParameter = mongos --setParameter = For additional configuration options, see :doc:`/reference/configuration-options`, :binary:`~bin.mongod` and :binary:`~bin.mongos`. Parameters ---------- .. |mongod-only| replace:: Available for :binary:`~bin.mongod` only. .. |mongos-only| replace:: Available for :binary:`~bin.mongos` only. .. |both| replace:: Available for both :binary:`~bin.mongod` and :binary:`~bin.mongos`. .. _authentication-parameters: Authentication Parameters ~~~~~~~~~~~~~~~~~~~~~~~~~ .. parameter:: authenticationMechanisms |both| Specifies the list of authentication mechanisms the server accepts. Set this to one or more of the following values. If you specify multiple values, use a comma-separated list and no spaces. For descriptions of the authentication mechanisms, see :doc:`/core/authentication`. .. include:: /includes/list-table-auth-mechanisms.rst .. include:: /includes/fact-startup-parameter For example, to specify both ``PLAIN`` and ``SCRAM-SHA-256`` as the authentication mechanisms, use the following command: .. _set-parameter-authenticationMechanisms-code: .. code-block:: bash mongod --setParameter authenticationMechanisms=PLAIN,SCRAM-SHA-256 --auth .. parameter:: awsSTSRetryCount .. versionchanged:: 7.0 (Also starting in 6.0.7 and 5.0.18) In previous versions, AWS IAM authentication retried only when the server returned an HTTP 500 error. |both| *Type*: integer *Default*: 2 For MongoDB deployments using `AWS IAM credentials `__ or `AWS IAM environment variables `__. Maximum number of AWS IAM authentication retries after a connection failure. The following example sets :parameter:`awsSTSRetryCount` to ``15`` retries: .. code-block:: bash mongod --setParameter awsSTSRetryCount=15 Alternatively, the following examples uses the :dbcommand:`setParameter` command within :binary:`~bin.mongosh`: .. code-block:: javascript db.adminCommand( { setParameter: 1, awsSTSRetryCount: 15 } ) .. parameter:: clusterAuthMode |both| Set the :setting:`~security.clusterAuthMode` to either ``sendX509`` or ``x509``. Useful during :ref:`rolling upgrade to use x509 for membership authentication ` to minimize downtime. .. include:: /includes/extracts/ssl-facts-see-more.rst .. include:: /includes/fact-runtime-parameter .. code-block:: bash db.adminCommand( { setParameter: 1, clusterAuthMode: "sendX509" } ) .. parameter:: enableLocalhostAuthBypass |both| *Default*: ``true`` Specify ``0`` or ``false`` to disable localhost authentication bypass. Enabled by default. .. include:: /includes/fact-startup-parameter See :ref:`localhost-exception` for more information. .. parameter:: enforceUserClusterSeparation |both| Set to ``false`` to disable the ``O/OU/DC`` check when ``clusterAuthMode`` is ``keyFile`` in your configuration file. This allows clients possessing member certificates to authenticate as users stored in the ``$external`` database. The server won't start if ``clusterAuthMode`` isn't ``keyFile`` in your configuration file. To set the ``enforceUserClusterSeparation`` parameter to ``false``, run the following command during startup: .. code-block:: javascript mongod --setParameter enforceUserClusterSeparation=false .. include:: /includes/fact-enforce-user-cluster-separation-parameter.rst .. parameter:: KeysRotationIntervalSec |both| *Default*: 7776000 seconds (90 days) Specifies the number of seconds for which an `HMAC signing key `_ is valid before rotating to the next one. This parameter is intended primarily to facilitate authentication testing. .. include:: /includes/fact-startup-parameter .. parameter:: ldapForceMultiThreadMode |mongod-only| *Default*: false Enables the performance of concurrent LDAP operations. .. note:: Only if you are certain that your instance of ``libldap`` is safe to use in this mode, enable this flag. You may experience crashes of the MongoDB process if the ``libldap`` version you are using is not thread safe. You must use :parameter:`ldapForceMultiThreadMode` to use LDAP connection pool. To enable LDAP connection pool, set :parameter:`ldapForceMultiThreadMode` and :parameter:`ldapUseConnectionPool` to ``true``. .. tip:: If you have any concerns regarding your MongoDB version, OS version or libldap version, please contact MongoDB Support. .. parameter:: ldapQueryPassword |mongod-only| *Type*: string The password used to bind to an LDAP server. You must use :parameter:`ldapQueryUser` with this parameter. If not set, mongod or mongos does not attempt to bind to the LDAP server. .. parameter:: ldapQueryUser |mongod-only| *Type*: string The user that binds to an LDAP server. You must use :parameter:`ldapQueryPassword` with this parameter. If not set, mongod or mongos does not attempt to bind to the LDAP server. .. parameter:: ldapRetryCount .. versionadded:: 6.1 |mongod-only| *Type*: integer *Default*: 0 For MongoDB deployments using :ref:`security-ldap-external`. Number of operation retries by the server LDAP manager after a network error. For example, the following sets :parameter:`ldapRetryCount` to ``3`` seconds: .. code-block:: bash mongod --ldapRetryCount=3 Or, if using the :dbcommand:`setParameter` command within :binary:`~bin.mongosh`: .. code-block:: javascript db.adminCommand( { setParameter: 1, ldapRetryCount: 3 } ) .. parameter:: ldapUserCacheInvalidationInterval .. versionchanged:: 5.2 |mongod-only| *Default*: 30 seconds .. note:: .. include:: /includes/LDAP-interval.rst For use with MongoDB deployments using :ref:`security-ldap-external`. The interval (in seconds) that the :binary:`~bin.mongod` instance waits between external user cache flushes. After MongoDB flushes the external user cache, MongoDB reacquires authorization data from the LDAP server the next time an LDAP-authorized user issues an operation. Increasing the value specified increases the amount of time MongoDB and the LDAP server can be out of sync, but reduces the load on the LDAP server. Conversely, decreasing the value specified decreases the time MongoDB and the LDAP server can be out of sync while increasing the load on the LDAP server. .. parameter:: ldapUserCacheRefreshInterval .. versionadded:: 5.2 |mongod-only| *Type*: integer *Default*: 30 seconds .. note:: .. include:: /includes/LDAP-interval.rst For MongoDB deployments using :ref:`security-ldap-external`. The interval in seconds that :binary:`~bin.mongod` waits before refreshing the cached user information from the LDAP server. The maximum interval is 86,400 seconds (24 hours). For example, the following sets :parameter:`ldapUserCacheRefreshInterval` to ``4000`` seconds: .. code-block:: bash mongod --setParameter ldapUserCacheRefreshInterval=4000 Or, if using the :dbcommand:`setParameter` command within :binary:`~bin.mongosh`: .. code-block:: javascript db.adminCommand( { setParameter: 1, ldapUserCacheRefreshInterval: 4000 } ) .. parameter:: ldapUserCacheStalenessInterval .. versionadded:: 5.2 |mongod-only| *Type*: integer *Default*: 90 seconds For MongoDB deployments using :ref:`security-ldap-external`. The interval in seconds that :binary:`~bin.mongod` retains the cached LDAP user information after the last cache refresh. If more than :parameter:`ldapUserCacheStalenessInterval` seconds elapse without a successful refresh of the user information from the LDAP server, then :binary:`~bin.mongod`: - Invalidates the cached LDAP user information. - Is unable to authenticate new sessions for LDAP users until :binary:`~bin.mongod` connects to the LDAP server and authorizes the LDAP user. - Authorizes any existing sessions that use previously authenticated LDAP users if :binary:`~bin.mongod` is unable to connect to the LDAP server. When :binary:`~bin.mongod` reconnects to the LDAP server, :binary:`~bin.mongod` ensures the LDAP users are correctly authorized. The maximum interval is 86,400 seconds (24 hours). For example, the following sets :parameter:`ldapUserCacheStalenessInterval` to ``4000`` seconds: .. code-block:: bash mongod --setParameter ldapUserCacheStalenessInterval=4000 Or, if using the :dbcommand:`setParameter` command within :binary:`~bin.mongosh`: .. code-block:: javascript db.adminCommand( { setParameter: 1, ldapUserCacheStalenessInterval: 4000 } ) .. parameter:: ldapUseConnectionPool |mongod-only| Specifies whether MongoDB should use connection pooling when connecting to the LDAP server for authentication/authorization. MongoDB uses the following default values: - true on Windows. - true on Linux where MongoDB Enterprise binaries are linked against ``libldap_r``. - false on Linux where MongoDB Enterprise binaries are linked against ``libldap``. You can only set :parameter:`ldapUseConnectionPool` during start-up, and cannot change this setting with the :dbcommand:`setParameter` database command. .. parameter:: ldapConnectionPoolUseLatencyForHostPriority |mongod-only| *Default*: true A boolean that determines whether the LDAP connection pool (see :parameter:`ldapUseConnectionPool`) should use latency of the LDAP servers to determine the connection order (from lowest latency to highest). You can only set :parameter:`ldapConnectionPoolUseLatencyForHostPriority` during start-up, and cannot change this setting during run time with the :dbcommand:`setParameter` database command. .. parameter:: ldapConnectionPoolMinimumConnectionsPerHost |mongod-only| *Default*: 1 The minimum number of connections to keep open to each LDAP server. You can only set :parameter:`ldapConnectionPoolMinimumConnectionsPerHost` during start-up, and cannot change this setting during run time with the :dbcommand:`setParameter` database command. .. parameter:: ldapConnectionPoolMaximumConnectionsPerHost |mongod-only| *Changed starting in MongoDB versions 5.0.9 and 6.0.0* Changed default value to ``2147483647``. In previous versions, the default is unset. *Default*: 2147483647 The maximum number of connections to keep open to each LDAP server. You can only set :parameter:`ldapConnectionPoolMaximumConnectionsPerHost` during start-up, and cannot change this setting during run time with the :dbcommand:`setParameter` database command. .. parameter:: ldapConnectionPoolMaximumConnectionsInProgressPerHost |mongod-only| *Changed starting in MongoDB versions 5.0.9 and 6.0.0* Changed default value to ``2``. In previous versions, the default is unset. *Default*: 2 The maximum number of in-progress connect operations to each LDAP server. You can only set :parameter:`ldapConnectionPoolMaximumConnectionsInProgressPerHost` during start-up, and cannot change this setting with the :dbcommand:`setParameter` database command. .. parameter:: ldapConnectionPoolHostRefreshIntervalMillis |mongod-only| *Default*: 60000 The number of milliseconds in-between health checks of the pooled LDAP connections. You can only set :parameter:`ldapConnectionPoolHostRefreshIntervalMillis` during start-up, and cannot change this setting with the :dbcommand:`setParameter` database command. .. parameter:: ldapConnectionPoolIdleHostTimeoutSecs |mongod-only| *Default*: 300 The maximum number of seconds that the pooled connections to an LDAP server can remain idle before being closed. You can only set :parameter:`ldapConnectionPoolIdleHostTimeoutSecs` during start-up, and cannot change this setting with the :dbcommand:`setParameter` database command. .. parameter:: ldapShouldRefreshUserCacheEntries .. versionadded:: 5.2 |mongod-only| *Type*: boolean *Default*: true For MongoDB deployments using :ref:`security-ldap-external`. .. include:: /includes/LDAP-interval.rst You can only set :parameter:`ldapShouldRefreshUserCacheEntries` during startup in the :setting:`configuration file ` or with the ``--setParameter`` option on the command line. For example, the following disables :parameter:`ldapShouldRefreshUserCacheEntries`: .. code-block:: bash mongod --setParameter ldapShouldRefreshUserCacheEntries=false .. parameter:: maxValidateMemoryUsageMB |mongod-only| .. versionadded:: 5.0 *Default*: 200 The maximum memory usage limit in megabytes for the :dbcommand:`validate` command. If the limit is exceeded, :dbcommand:`validate` returns as many results as possible and warns that not all corruption might be reported because of the limit. .. include:: /includes/fact-runtime-startup-parameter .. parameter:: oidcIdentityProviders |mongod-only| .. versionchanged:: 8.0 (*Also available in 7.3 and 7.0*) Use this parameter to specify identity provider (IDP) configurations when using :ref:`OpenID Connect Authentication `. ``oidcIdentityProviders`` accepts an array of zero or more identity provider (IDP) configurations. An empty array (default) indicates no OpenID Connect support is enabled. When more than one IDP is defined, ``oidcIdentityProviders`` uses the ``matchPattern`` field to select an IDP. Array order determines the priority and the first IDP is always selected. .. include:: /includes/fact-oidc-multiple-config-for-same-issuer.rst .. _oidcidentityproviders-fields: oidcIdentityProviders Fields ```````````````````````````` .. include:: /includes/fact-oidc-providers.rst .. include:: /includes/fact-startup-parameter .. parameter:: ocspEnabled |both| Available on Linux and macOS. *Default*: true The flag that enables or disables OCSP. .. include:: /includes/fact-startup-parameter For example, the following disables OCSP: .. code-block:: bash mongod --setParameter ocspEnabled=false ... .. include:: /includes/fact-ocsp-enabled.rst .. seealso:: - :parameter:`ocspValidationRefreshPeriodSecs` - :parameter:`tlsOCSPStaplingTimeoutSecs` - :parameter:`tlsOCSPVerifyTimeoutSecs` .. parameter:: ocspValidationRefreshPeriodSecs |both| Available on Linux. The number of seconds to wait before refreshing the stapled OCSP status response. Specify a number greater than or equal to 1. You can only set :parameter:`ocspValidationRefreshPeriodSecs` during startup in the :setting:`configuration file ` or with the ``--setParameter`` option on the command line. For example, the following sets the parameter to 3600 seconds: .. code-block:: bash mongod --setParameter ocspValidationRefreshPeriodSecs=3600 ... Starting in MongoDB 5.0, the :dbcommand:`rotateCertificates` command and :method:`db.rotateCertificates()` method will also refresh any stapled OCSP responses. .. seealso:: - :parameter:`ocspEnabled` - :parameter:`tlsOCSPStaplingTimeoutSecs` - :parameter:`tlsOCSPVerifyTimeoutSecs` .. parameter:: opensslCipherConfig |both| *Available on Linux only* With the use of native TLS/SSL libraries, the parameter :parameter:`opensslCipherConfig` is supported for Linux/BSD and no longer supported in Windows and macOS. Specify the cipher string for OpenSSL when using TLS/SSL encryption. For a list of cipher strings, see ``_. Multiple cipher strings can be provided as a colon-separated list. .. note:: This parameter is only for use with TLS 1.2 or earlier. To specify cipher suites for use with TLS 1.3, use the :parameter:`opensslCipherSuiteConfig` parameter. .. include:: /includes/fact-startup-parameter The use of ``TLS`` options is preferred over ``SSL`` options. The TLS options have the same functionality as the ``SSL`` options. The following example configures a :binary:`~bin.mongod` with a :parameter:`opensslCipherConfig` cipher string of ``'HIGH:!EXPORT:!aNULL@STRENGTH'``: .. code-block:: bash mongod --setParameter opensslCipherConfig='HIGH:!EXPORT:!aNULL@STRENGTH' --tlsMode requireTLS --tlsCertificateKeyFile Certs/server.pem .. parameter:: opensslCipherSuiteConfig |both| .. versionadded:: 5.0 *Available on Linux only* Specify the list of supported cipher suites OpenSSL should permit when using TLS 1.3 encryption. For a list of cipher suites for use with TLS 1.3, see ``_. Multiple cipher suites can be provided as a colon-separated list. .. note:: This parameter is only for use with TLS 1.3. To specify cipher strings for use with TLS 1.2 or earlier, use the :parameter:`opensslCipherConfig` parameter. .. include:: /includes/fact-startup-parameter For example, the following configures a :binary:`~bin.mongod` with a :parameter:`opensslCipherSuiteConfig` cipher suite of ``'TLS_AES_256_GCM_SHA384'`` for use with TLS 1.3: .. code-block:: bash mongod --setParameter opensslCipherSuiteConfig='TLS_AES_256_GCM_SHA384' --tlsMode requireTLS --tlsCertificateKeyFile Certs/server.pem .. parameter:: opensslDiffieHellmanParameters |both| *Available on Linux only* Specify the path to the PEM file that contains the OpenSSL Diffie-Hellman parameters when using TLS 1.2 or previous. Specifying the OpenSSL Diffie-Hellman parameters enables support for :ref:`dhe` cipher suites during TLS/SSL encryption. This parameter is not supported for use with TLS 1.3. Ephemeral Diffie-Hellman (DHE) cipher suites (and Ephemeral Elliptic Curve Diffie-Hellman (ECDHE) cipher suites) provide :ref:`tls-forward-secrecy`. :ref:`tls-forward-secrecy` cipher suites create an ephemeral session key that is protected by the server's private key but never transmitted. This ensures that even if a server's private key is compromised, you cannot decrypt past sessions with the compromised key. .. note:: If :parameter:`opensslDiffieHellmanParameters` is unset but :ref:`ECDHE ` is enabled, MongoDB enables DHE using the ``ffdhe3072`` Diffie-Hellman parameter, as defined in :rfc:`7919#appendix-A.2`. The ``ffdhe3072`` is a strong parameter (specifically, size is greater than 1024). Strong parameters are not supported with Java 6 and 7 unless extended support has been purchased from Oracle. .. include:: /includes/fact-startup-parameter If for performance reasons, you need to disable support for DHE cipher suites, use the :parameter:`opensslCipherConfig` parameter: .. code-block:: bash mongod --setParameter opensslCipherConfig='HIGH:!EXPORT:!aNULL:!DHE:!kDHE@STRENGTH' ... .. parameter:: saslauthdPath |both| .. note:: Available only in MongoDB Enterprise (except MongoDB Enterprise for Windows). Specify the path to the Unix Domain Socket of the ``saslauthd`` instance to use for proxy authentication. .. include:: /includes/fact-startup-parameter .. parameter:: saslHostName |both| :parameter:`saslHostName` overrides MongoDB's default hostname detection for the purpose of configuring SASL and Kerberos authentication. :parameter:`saslHostName` does not affect the hostname of the :binary:`~bin.mongod` or :binary:`~bin.mongos` instance for any purpose beyond the configuration of SASL and Kerberos. .. include:: /includes/fact-startup-parameter .. note:: :parameter:`saslHostName` supports Kerberos authentication and is only included in MongoDB Enterprise. For more information, see the following: - Linux: :doc:`/tutorial/control-access-to-mongodb-with-kerberos-authentication` - Windows: :doc:`/tutorial/control-access-to-mongodb-windows-with-kerberos-authentication` .. parameter:: saslServiceName |both| Allows users to override the default :doc:`Kerberos ` service name component of the :doc:`Kerberos ` principal name, on a per-instance basis. If unspecified, the default value is ``mongodb``. .. include:: /includes/fact-startup-parameter :parameter:`saslServiceName` is only available in MongoDB Enterprise. .. important:: Ensure that your driver supports alternate service names. .. parameter:: scramIterationCount |both| *Default*: ``10000`` Changes the number of hashing iterations used for all new ``SCRAM-SHA-1`` passwords. More iterations increase the amount of time required for clients to authenticate to MongoDB, but makes passwords less susceptible to brute-force attempts. The default value is ideal for most common use cases and requirements. If you modify this value, it does not change the iteration count for existing passwords. The :parameter:`scramIterationCount` value must be ``5000`` or greater. .. include:: /includes/fact-runtime-startup-parameter For example, the following sets the :parameter:`scramIterationCount` to ``12000``. .. code-block:: bash mongod --setParameter scramIterationCount=12000 Or, if using the :dbcommand:`setParameter` command within :binary:`~bin.mongosh`: .. code-block:: javascript db.adminCommand( { setParameter: 1, scramIterationCount: 12000 } ) .. seealso:: - :method:`db.changeUserPassword()` - :method:`db.createUser()` - :method:`db.updateUser()` .. parameter:: scramSHA256IterationCount |both| *Default*: ``15000`` Changes the number of hashing iterations used for all new ``SCRAM-SHA-256`` passwords. More iterations increase the amount of time required for clients to authenticate to MongoDB, but makes passwords less susceptible to brute-force attempts. The default value is ideal for most common use cases and requirements. If you modify this value, it does not change iteration count for existing passwords. The :parameter:`scramSHA256IterationCount` value must be ``5000`` or greater. .. include:: /includes/fact-runtime-startup-parameter For example, the following sets the :parameter:`scramSHA256IterationCount` to ``20000``. .. code-block:: bash mongod --setParameter scramSHA256IterationCount=20000 Or, if using the :dbcommand:`setParameter` command within :binary:`~bin.mongosh`: .. code-block:: javascript db.adminCommand( { setParameter: 1, scramSHA256IterationCount: 20000 } ) .. seealso:: - :method:`db.changeUserPassword()` - :method:`db.createUser()` - :method:`db.updateUser()` .. parameter:: sslMode |both| Set the ``net.ssl.mode`` to either ``preferSSL`` or ``requireSSL``. Useful during :doc:`rolling upgrade to TLS/SSL ` to minimize downtime. .. include:: /includes/extracts/ssl-facts-see-more.rst .. include:: /includes/fact-runtime-parameter .. code-block:: bash db.adminCommand( { setParameter: 1, sslMode: "preferSSL" } ) .. seealso:: :parameter:`tlsMode` .. parameter:: tlsMode |both| Set to either: - ``preferTLS`` - ``requireTLS`` The :parameter:`tlsMode` parameter is useful during :doc:`rolling upgrade to TLS/SSL ` to minimize downtime. .. include:: /includes/fact-runtime-parameter .. code-block:: bash db.adminCommand( { setParameter: 1, tlsMode: "preferTLS" } ) .. include:: /includes/extracts/ssl-facts-see-more.rst .. seealso:: :parameter:`sslMode` .. parameter:: tlsClusterAuthX509Override |both| .. versionadded:: 7.0 Overrides the :setting:`~net.tls.clusterAuthX509` configuration options. .. code-block:: yaml setParameter: tlsClusterAuthX509Override: { attributes: O=MongoDB, OU=MongoDB Server } The parameter supports ``attributes`` and ``extensionValue`` overrides. .. include:: /includes/fact-x509-authorization Use this parameter to rotate certificates when the new certificates have different attributes or extension values. .. include:: /includes/fact-startup-parameter .. parameter:: tlsOCSPStaplingTimeoutSecs |both| Available for Linux. The maximum number of seconds the :binary:`mongod` / :binary:`mongos` instance should wait to receive the OCSP status response for its certificates. Specify an integer greater than or equal to (``>=``) 1. If unset, :parameter:`tlsOCSPStaplingTimeoutSecs` uses the :parameter:`tlsOCSPVerifyTimeoutSecs` value. .. include:: /includes/fact-startup-parameter For example, the following sets the :parameter:`tlsOCSPStaplingTimeoutSecs` to 20 seconds: .. code-block:: bash mongod --setParameter tlsOCSPStaplingTimeoutSecs=20 ... .. seealso:: - :parameter:`ocspEnabled` - :parameter:`ocspValidationRefreshPeriodSecs` - :parameter:`tlsOCSPVerifyTimeoutSecs` .. parameter:: tlsOCSPVerifyTimeoutSecs |both| Available for Linux and Windows. *Default*: 5 The maximum number of seconds that the :binary:`mongod` / :binary:`mongos` should wait for the OCSP response when verifying server certificates. Specify an integer greater than or equal to (``>=``) 1. .. include:: /includes/fact-startup-parameter For example, the following sets the :parameter:`tlsOCSPVerifyTimeoutSecs` to 20 seconds: .. code-block:: bash mongod --setParameter tlsOCSPVerifyTimeoutSecs=20 ... .. seealso:: - :parameter:`ocspEnabled` - :parameter:`ocspValidationRefreshPeriodSecs` - :parameter:`tlsOCSPStaplingTimeoutSecs` .. parameter:: tlsUseSystemCA |mongod-only| *Type*: boolean *Default*: false Specifies whether MongoDB loads TLS certificates that are already available to the operating system's certificate authority. .. important:: .. include:: /includes/fact-ssl-tlsCAFile-tlsUseSystemCA.rst .. include:: /includes/fact-startup-parameter For example, to set ``tlsUseSystemCA`` to ``true``: .. code-block:: bash mongod --setParameter tlsUseSystemCA=true .. include:: /includes/extracts/ssl-facts-see-more.rst .. parameter:: tlsWithholdClientCertificate |both| *Default*: false A TLS certificate is set for a :binary:`mongod ` or :binary:`mongos ` either by the :option:`--tlsClusterFile ` option or by the :option:`--tlsCertificateKeyFile ` option when :option:`--tlsClusterFile ` is not set. If the TLS certificate is set, by default, the instance sends the certificate when initiating intra-cluster communications with other :binary:`mongod ` or :binary:`mongos ` instances in the deployment. Set ``tlsWithholdClientCertificate`` to ``1`` or ``true`` to direct the instance to withhold sending its TLS certificate during these communications. Use this option with :option:`--tlsAllowConnectionsWithoutCertificates ` (to allow inbound connections without certificates) on all members of the deployment. ``tlsWithholdClientCertificate`` is mutually exclusive with :option:`--clusterAuthMode x509 `. .. include:: /includes/fact-startup-parameter .. parameter:: tlsX509ClusterAuthDNOverride |both| An alternative Distinguished Name (DN) that the instance can also use to identify members of the deployment. For a MongoDB deployment that uses X.509 certificates for :setting:`~security.clusterAuthMode`, deployment members identify each other using X.509 certificates ( :setting:`net.tls.clusterFile`, if specified, and :setting:`net.tls.certificateKeyFile`) during intra-cluster communications. For members of the same deployment, the ``DN`` from their certificates must have the same Organization attributes (``O``\'s), the Organizational Unit attributes (``OU``\'s), and the Domain Components (``DC``\'s). If :parameter:`tlsX509ClusterAuthDNOverride` is set for a member, the member can also use the override value when comparing the ``DN`` components (``O``\'s, ``OU``\'s, and ``DC``\'s) of the presented certificates. That is the member checks the presented certificates against its :setting:`net.tls.clusterFile`/:setting:`net.tls.certificateKeyFile`. If the DN does not match, the member checks the presented certificate against the :parameter:`tlsX509ClusterAuthDNOverride` value. .. note:: If set, you must set this parameter on all members of the deployment. .. include:: /includes/fact-runtime-startup-parameter You can use this parameter for a rolling update of certificates to new certificates that contain a new ``DN`` value. See :doc:`/tutorial/rotate-x509-membership-certificates`. For more information about membership certificate requirements, see :ref:`x509-member-certificate-requirements` for details. .. parameter:: tlsX509ExpirationWarningThresholdDays |both| *Default* : 30 :binary:`mongod` / :binary:`mongos` logs a warning on connection if the presented X.509 certificate expires within ``30`` days of the ``mongod/mongos`` system clock. Use the :parameter:`tlsX509ExpirationWarningThresholdDays` parameter to control the certificate expiration warning threshold: - Increase the parameter value to trigger warnings farther ahead of the certificate expiration date. - Decrease the parameter value to trigger warnings closer to the certificate expiration date. - Set the parameter to ``0`` to disable the warning. This parameter has a minimum value of ``0``. .. include:: /includes/fact-startup-parameter For more information on X.509 certificate validity, see `RFC 5280 4.1.2.5 `__. .. parameter:: userCacheInvalidationIntervalSecs |mongos-only| *Default*: 30 On a :binary:`~bin.mongos` instance, specifies the interval (in seconds) at which the :binary:`~bin.mongos` instance checks to determine whether the in-memory cache of :doc:`user objects ` has stale data, and if so, clears the cache. If there are no changes to user objects, :binary:`~bin.mongos` will not clear the cache. This parameter has a minimum value of ``1`` second and a maximum value of ``86400`` seconds (24 hours). .. include:: /includes/fact-runtime-startup-parameter .. parameter:: authFailedDelayMs |both| *Default*: 0 .. include:: /includes/fact-enterprise-only-admonition.rst The number of milliseconds to wait before informing clients that their authentication attempt has failed. This parameter may be in the range ``0`` to ``5000``, inclusive. Setting this parameter makes brute-force login attacks on a database more time-consuming. However, clients waiting for a response from the MongoDB server still consume server resources, and this may adversely impact benign login attempts if the server is denying access to many other clients simultaneously. .. parameter:: allowRolesFromX509Certificates |both| *Default*: true A boolean flag that allows or disallows the retrieval of authorization roles from client X.509 certificates. .. include:: /includes/fact-startup-parameter General Parameters ~~~~~~~~~~~~~~~~~~ .. parameter:: allowDiskUseByDefault |mongod-only| *Default*: True .. include:: /includes/fact-allowDiskUseByDefault.rst .. include:: /includes/fact-runtime-startup-parameter .. code-block:: bash mongod --setParameter allowDiskUseByDefault=false :parameter:`allowDiskUseByDefault` only works on :binary:`mongod` not :binary:`mongos`. :binary:`mongos` never writes temporary files to disk. Use the :dbcommand:`setParameter` command in a :binary:`mongosh` session that is connected to a running :binary:`mongod` to change the value of the parameter while the server is running: .. code-block:: javascript db.adminCommand( { setParameter: 1, allowDiskUseByDefault: false } ) .. parameter:: httpVerboseLogging |both| Adds more verbose tracing for curl on Linux and macOS. Has no affect on Windows. By default, the parameter is unset. .. include:: /includes/fact-runtime-startup-parameter .. code-block:: bash mongos --setParameter httpVerboseLogging=true .. parameter:: slowConnectionThresholdMillis .. versionadded:: 6.3 |both| *Default*: 100 Sets the time limit in milliseconds to log the establishment of slow server connections. If a connection takes longer to establish than the :parameter:`slowConnectionThresholdMillis` parameter, an event is added to the :ref:`log ` with the message ``msg`` field set to ``"Slow connection establishment"``. .. include:: /includes/fact-runtime-startup-parameter The following example sets :parameter:`slowConnectionThresholdMillis` to ``250`` milliseconds. .. code-block:: bash mongod --setParameter slowConnectionThresholdMillis=250 Or, if using the :dbcommand:`setParameter` command within :binary:`~bin.mongosh`: .. code-block:: javascript db.adminCommand( { setParameter: 1, slowConnectionThresholdMillis: 250 } ) .. parameter:: connPoolMaxConnsPerHost |both| *Default*: 200 Sets the maximum size of the legacy connection pools for outgoing connections to other :binary:`~bin.mongod` instances in the global connection pool. The size of a pool does not prevent the creation of additional connections, but *does* prevent a connection pool from retaining connections in excess of the value of :parameter:`connPoolMaxConnsPerHost`. .. note:: The parameter is separate from the connections in TaskExecutor pools. See :parameter:`ShardingTaskExecutorPoolMaxSize`. **Only** adjust this setting if your driver does *not* pool connections and you're using authentication in the context of a sharded cluster. .. include:: /includes/fact-startup-parameter .. code-block:: bash mongod --setParameter connPoolMaxConnsPerHost=250 .. parameter:: connPoolMaxInUseConnsPerHost |both| Sets the maximum number of in-use connections at any given time for for outgoing connections to other :binary:`~bin.mongod` instances in the legacy global connection pool. By default, the parameter is unset. .. include:: /includes/fact-startup-parameter .. code-block:: bash mongod --setParameter connPoolMaxInUseConnsPerHost=100 .. seealso:: :parameter:`connPoolMaxConnsPerHost` .. parameter:: globalConnPoolIdleTimeoutMinutes |both| Sets the time limit that connection in the legacy global connection pool can remain idle before being closed. By default, the parameter is unset. .. include:: /includes/fact-startup-parameter .. code-block:: bash mongos --setParameter globalConnPoolIdleTimeoutMinutes=10 .. parameter:: cursorTimeoutMillis |both| *Default*: 600000 (10 minutes) Sets the expiration threshold in milliseconds for idle cursors before MongoDB removes them; specifically, MongoDB removes cursors that have been idle for the specified :parameter:`cursorTimeoutMillis`. .. include:: /includes/fact-runtime-startup-parameter For example, the following sets the :parameter:`cursorTimeoutMillis` to ``300000`` milliseconds (5 minutes). .. code-block:: bash mongod --setParameter cursorTimeoutMillis=300000 Or, if using the :dbcommand:`setParameter` command within :binary:`~bin.mongosh`: .. code-block:: javascript db.adminCommand( { setParameter: 1, cursorTimeoutMillis: 300000 } ) Setting :parameter:`cursorTimeoutMillis` to less than or equal to ``0`` results in all cursors being immediately eligible for timeout. Generally, the timeout value should be greater than the average amount of time for a query to return results. Use tools like the :method:`cursor.explain()` cursor modifier to analyze the average query time and select an appropriate timeout period. .. warning:: MongoDB cleans up :term:`orphaned cursors ` linked to sessions as part of session management. This means that orphaned cursors with session ids do not use ``cursorTimeoutMillis`` to control the timeout. For operations that return a cursor and have an idle period longer than :parameter:`localLogicalSessionTimeoutMinutes`, use :method:`Mongo.startSession()` to perform the operation within an explicit session. To refresh the session, run the :dbcommand:`refreshSessions` command. For details, see :ref:``. .. parameter:: maxNumActiveUserIndexBuilds |mongod-only| *Type*: integer *Default*: 3 Sets the maximum number of concurrent index builds allowed on the :term:`primary`. This is a global limit that applies across all collections. Increasing the value of ``maxNumActiveUserIndexBuilds`` allows additional concurrent index builds at the cost of increased pressure on the WiredTiger cache. System indexes are not limited to ``maxNumActiveUserIndexBuilds``, however a system index build counts against the limit for user index builds. After the server reaches ``maxNumActiveUserIndexBuilds``, it blocks additional user index builds until the number of concurrent index builds drops below the ``maxNumActiveUserIndexBuilds`` limit. If an index build is blocked, the server logs this message: .. code-block:: sh :copyable: false Too many index builds running simultaneously, waiting until the number of active index builds is below the threshold. .. include:: /includes/fact-runtime-startup-parameter The following command sets a limit of 4 concurrent index builds: .. code-block:: javascript db.adminCommand( { setParameter: 1, maxNumActiveUserIndexBuilds: 4 } ) See also: - :parameter:`maxIndexBuildMemoryUsageMegabytes` - :ref:`index-creation-background` .. parameter:: notablescan |mongod-only| Specify whether **all** queries must use indexes. If ``1``, MongoDB will not execute queries that require a collection scan and will return an error. Consider the following example which sets :parameter:`notablescan` to ``1`` or true: .. code-block:: javascript db.adminCommand( { setParameter: 1, notablescan: 1 } ) Setting :parameter:`notablescan` to ``1`` can be useful for testing application queries, for example, to identify queries that scan an entire collection and cannot use an index. To detect unindexed queries without ``notablescan``, consider reading the :doc:`/tutorial/evaluate-operation-performance` and :doc:`/tutorial/optimize-query-performance-with-indexes-and-projections` sections and using the :parameter:`logLevel` parameter, :binary:`~bin.mongostat` and :ref:`profiling `. Don't run production :binary:`~bin.mongod` instances with :parameter:`notablescan` because preventing collection scans can potentially affect queries in all databases, including administrative queries. .. include:: /includes/fact-runtime-startup-parameter .. note:: ``notablescan`` does not allow unbounded queries that use a clustered index because the queries require a full collection scan. For more information, see :ref:`Collection Scans `. .. parameter:: ttlMonitorEnabled |mongod-only| *Default*: ``true`` To support :ref:`TTL Indexes `, :binary:`~bin.mongod` instances have a background thread that is responsible for deleting documents from collections with TTL indexes. .. include:: /includes/fact-runtime-startup-parameter To disable this worker thread for a :binary:`~bin.mongod`, set :parameter:`ttlMonitorEnabled` to ``false``, as in the following operations: .. code-block:: javascript db.adminCommand( { setParameter: 1, ttlMonitorEnabled: false } ) Alternately, you may disable the thread at startup time by starting the :binary:`~bin.mongod` instance with the following option: .. code-block:: bash mongod --setParameter ttlMonitorEnabled=false .. important:: Do not run production :binary:`~bin.mongod` instances with ``ttlMonitorEnabled`` disabled, except under guidance from MongoDB support. Preventing TTL document removal can negatively impact MongoDB internal system operations that depend on TTL Indexes. .. parameter:: tcpFastOpenServer |both| *Default*: ``true`` Enables support for accepting inbound TCP Fast Open (TFO) connections to the ``mongod/mongos`` from a client. TFO requires both the client and ``mongod/mongos`` host machine support and enable TFO: Windows The following Windows operating systems support TFO: - Microsoft Windows Server 2016 and later. - Microsoft Windows 10 Update 1607 and later. macOS macOS 10.11 (El Capitan) and later support TFO. Linux Linux operating systems running Linux Kernel 3.7 or later can support inbound TFO. Set the value of ``/proc/sys/net/ipv4/tcp_fastopen`` to enable inbound TFO connections: - Set to ``2`` to enable only inbound TFO connections. - Set to ``3`` to enable inbound and outbound TFO connections. This parameter has no effect if the host operating system does not support *or* is not configured to support TFO connections. .. include:: /includes/fact-startup-parameter .. seealso:: `RFC7413 `__. .. parameter:: tcpFastOpenClient |both| *Default*: ``true`` *Linux Operating System Only* Enables support for outbound TCP Fast Open (TFO) connections from the ``mongod/mongos`` to a client. TFO requires both the client and the ``mongod/mongos`` host machine support and enable TFO. Linux operating systems running Linux Kernel 4.11 or later can support outbound TFO. Set the value of ``/proc/sys/net/ipv4/tcp_fastopen`` to enable outbound TFO connections: - ``1`` to enable only outbound TFO connections. - ``3`` to enable inbound and outbound TFO connections. This parameter has no effect if the host operating system does not support *or* is not configured to support TFO connections. .. include:: /includes/fact-startup-parameter .. seealso:: `RFC7413 `__. .. parameter:: tcpFastOpenQueueSize |both| *Default*: ``1024`` As part of establishing a TCP Fast Open (TFO) connection, the client submits a valid TFO cookie to the ``mongod/mongos`` *before* completion of the standard TCP 3-way handshake. The ``mongod/mongos`` keeps a queue of all such pending TFO connections. The ``tcpFastOpenQueueSize`` parameter sets the size of the queue of pending TFO connections. While the queue is full, the ``mongod/mongos`` falls back to the normal three-way handshake for incoming client requests and ignores the presence of TFO cookies. Once the queue size falls back below the limit, the ``mongod/mongos`` begins accepting new TFO cookies. - Increasing the default queue size may improve the effect of TFO on network performance. However, large queue sizes also increase the risk of server resource exhaustion due to excessive incoming TFO requests. - Decreasing the default queue size may reduce the risk of resource server resource exhaustion due to excessive incoming TFO requests. However, small queue sizes may also reduce the effect of TFO on network performance. The minimum queue size is ``0``. A queue of ``0`` effectively disables TFO. This parameter has no effect on host operating systems that do not support or are not configured for TFO connections. .. include:: /includes/fact-startup-parameter .. seealso:: - `RFC7413 TCP Fast Open Section 5: Security Considerations `__ - `RFC7413 TCP Fast Open Section 6: TFO Applicability `__ .. parameter:: disableJavaScriptJIT .. important:: Starting in MongoDB 8.0, this parameter has no effect. .. parameter:: indexBuildMinAvailableDiskSpaceMB .. versionadded:: 7.1 |mongod-only| *Default*: 500 MB Sets the minimum available disk space in megabytes required for index builds. Must be greater than or equal to 0 MB, and less than or equal to 8 TB. 0 disables the minimum disk space requirement. .. include:: /includes/index-build-disk-space-parameter.rst .. warning:: If you increase ``indexBuildMinAvailableDiskSpaceMB``, ensure your server has enough available disk space. Also, if you set ``indexBuildMinAvailableDiskSpaceMB`` too high, you might needlessly prevent index builds when there is enough available disk space and ``indexBuildMinAvailableDiskSpaceMB`` could be set lower. .. include:: /includes/fact-runtime-startup-parameter The following example sets ``indexBuildMinAvailableDiskSpaceMB`` to 650 MB: .. code-block:: javascript db.adminCommand( { setParameter: 1, indexBuildMinAvailableDiskSpaceMB: 650 } ) You can also set ``indexBuildMinAvailableDiskSpaceMB`` at startup. For example: .. code-block:: bash mongod --setParameter indexBuildMinAvailableDiskSpaceMB=650 .. parameter:: indexMaxNumGeneratedKeysPerDocument |both| .. versionadded:: 5.3 *Default*: 100000 Limits the maximum number of keys generated for a document to prevent out of memory errors. It is possible to raise the limit, but if an operation requires more keys than the :parameter:`indexMaxNumGeneratedKeysPerDocument` parameter specifies, the operation will fail. .. include:: /includes/fact-startup-parameter .. parameter:: maxIndexBuildMemoryUsageMegabytes |mongod-only| *Default*: 200 Limits the amount of memory that simultaneous index builds on one collection may consume for the duration of the builds. The specified amount of memory is shared between all indexes built using a single :dbcommand:`createIndexes` command or its shell helper :method:`db.collection.createIndexes()`. .. include:: /includes/fact-runtime-startup-parameter The memory consumed by an index build is separate from the WiredTiger cache memory (see :setting:`~storage.wiredTiger.engineConfig.cacheSizeGB`). ``maxIndexBuildMemoryUsageMegabytes`` sets a limit on how much memory the index build uses at once. This can impact performance when the :ref:`index build process ` generates and sorts keys for the index. Increasing the memory limit improves sorting performance during an index build. .. include:: /includes/fact-index-build-memory-limit.rst Changing ``maxIndexBuildMemoryUsageMegabytes`` does not affect an in progress index build if it has already started a collection scan. However, a forced replica set reconfiguration restarts the collection scan and uses the most current ``maxIndexBuildMemoryUsageMegabytes`` provided. .. include:: /includes/extracts/4.2-index-limit.rst .. parameter:: reportOpWriteConcernCountersInServerStatus |mongod-only| *Default*: false A boolean flag that determines whether the :method:`db.serverStatus()` method and :dbcommand:`serverStatus` command return :serverstatus:`opWriteConcernCounters` information. [#perf]_ .. include;: /includes/fact-starutp-parameter .. code-block:: bash mongod --setParameter reportOpWriteConcernCountersInServerStatus=true .. [#perf] Enabling :parameter:`reportOpWriteConcernCountersInServerStatus` can have a negative performance impact; specifically, when running *without* TLS. .. parameter:: watchdogPeriodSeconds |mongod-only| *Type*: integer *Default*: -1 (disabled) Determines how frequent the :ref:`Storage Node Watchdog ` checks the status of the monitored filesystems: * The :option:`--dbpath ` directory * The ``journal`` directory inside the :option:`--dbpath ` directory * The directory of :option:`--logpath ` file * The directory of :option:`--auditPath ` file Valid values for :parameter:`watchdogPeriodSeconds` are: - ``-1`` (the default), to disable/pause :ref:`Storage Node Watchdog `, or - An integer greater than or equal to 60. .. note:: - If a filesystem on a monitored directory becomes unresponsive, it can take a maximum of nearly *twice* the value of :parameter:`watchdogPeriodSeconds` to terminate the :binary:`~bin.mongod`. - If any of its monitored directory is a symlink to other volumes, the Storage Node Watchdog does not monitor the symlink target. For example, if the :binary:`~bin.mongod` uses :setting:`storage.directoryPerDB: true ` (or :option:`--directoryperdb `) and symlinks a database directory to another volume, the Storage Node Watchdog does not follow the symlink to monitor the target. To enable :ref:`Storage Node Watchdog `, :parameter:`watchdogPeriodSeconds` must be set during startup. .. code-block:: bash mongod --setParameter watchdogPeriodSeconds=60 You can only enable the :ref:`Storage Node Watchdog ` at startup. However, once enabled, you can pause the :ref:`Storage Node Watchdog ` or change the :parameter:`watchdogPeriodSeconds` during run time. Once enabled, - To pause the :ref:`Storage Node Watchdog ` during run time, set :parameter:`watchdogPeriodSeconds` to -1. .. code-block:: javascript db.adminCommand( { setParameter: 1, watchdogPeriodSeconds: -1 } ) - To resume or change the period during run time, set :parameter:`watchdogPeriodSeconds` to a number greater than or equal to 60. .. code-block:: javascript db.adminCommand( { setParameter: 1, watchdogPeriodSeconds: 120 } ) .. note :: It is an error to set :parameter:`watchdogPeriodSeconds` at run time if the :ref:`Storage Node Watchdog ` was not enabled at startup time. .. seealso: :ref:`storage-node-watchdog` .. warning :: ``tcmallocAggressiveMemoryDecommit`` is deprecated in 8.0. MongoDB 8.0 uses an updated version of ``tcmalloc`` that improves memory fragmentation and management. See :ref:`tcmalloc upgrade <8.0-tcmalloc-upgrade>` for more information. To release memory back to the operating system, consider using :parameter:`tcmallocEnableBackgroundThread` instead. .. parameter:: tcmallocEnableBackgroundThread |both| .. versionadded:: 8.0 *Type*: boolean Default: true If set to ``true``, ``tcmallocEnableBackgroundThread`` creates a background thread that periodically releases memory back to the operating system. The value of :parameter:`tcmallocReleaseRate` determines the rate, in bytes per second, at which the background thread releases memory. .. include:: /includes/fact-background-thread-release-rate.rst For improved memory usage, we recommend using the default value of ``true``. To learn more about improvements to performance and memory management, see :ref:`8.0-tcmalloc-upgrade`. .. include:: /includes/fact-startup-parameter.rst The following operation sets ``tcmallocEnableBackgroundThread`` to ``false``: .. code-block:: bash mongod --setParameter "tcmallocEnableBackgroundThread=false" .. parameter:: tcmallocReleaseRate |both| .. versionchanged:: 8.0 Default: 0 Specifies the `TCMalloc release rate `__ in bytes per second. "Release rate" refers to the *minimum* rate at which MongoDB releases unused memory to the system. To return memory back to the system more quickly, increase the release rate; to return memory more slowly, decrease the release rate. .. include:: /includes/fact-background-thread-release-rate.rst Starting in MongoDB 8.0, the default value of ``tcmallocReleaseRate`` is reduced to ``0`` due to a :ref:`tcmalloc upgrade <8.0-tcmalloc-upgrade>` that prioritizes CPU performance over memory release. Even if ``tcmallocReleaseRate`` is set to ``0``, ``tcmalloc`` may release memory back to the system, especially if it is near the heap limit. If :parameter:`tcmallocEnableBackgroundThread` is enabled, ``tcmalloc`` may also release memory from its intermediate caches. .. include:: /includes/fact-tcmalloc-release-rate-compatibility.rst .. important:: If you run MongoDB on a platform that uses ``tcmalloc-gperf`` such as Windows, PPC, or s390x, ``tcmallocReleaseRate`` has the same behavior as earlier MongoDB versions. .. include:: /includes/fact-runtime-startup-parameter To modify the release rate during run time, you can use the :dbcommand:`setParameter` command. For example: .. code-block:: javascript db.adminCommand( { setParameter: 1, tcmallocReleaseRate: 2097152 } ) You can also set :parameter:`tcmallocReleaseRate` at startup time; for example: .. code-block:: bash mongod --setParameter "tcmallocReleaseRate=5.0" .. parameter:: fassertOnLockTimeoutForStepUpDown .. versionadded:: 5.3 |both| Default: 15 seconds Allows a server that receives a request to step up or step down, to terminate if it is unable to comply (for example due to faulty server disks) within the timeout. This enables a cluster to successfully elect a new primary node and thus continue to be available. ``fassertOnLockTimeoutForStepUpDown`` defaults to 15 seconds. To disable nodes from fasserting, set ``fassertOnLockTimeoutForStepUpDown=0``. .. include:: /includes/fact-runtime-startup-parameter The following example disables nodes from fasserting: .. code-block:: bash mongod --setParameter fassertOnLockTimeoutForStepUpDown=0 .. parameter:: ingressAdmissionControllerTicketPoolSize |mongod-only| *Default*: ``1000000`` Controls the maximum number of operations admitted concurrently to the ingress queue. The default value of ``1000000`` represents the numerical equivalent of unbounded, which admits all incoming operations up to the default maximum connections that MongoDB allows. Increasing this value while there are operations waiting on the queue unblocks as many operations as the new pool size permits. Decreasing this value does not block any currently executing operations, but incoming controllable operations are blocked until there are tickets available. .. code-block:: bash mongod --setParameter ingressAdmissionControllerTicketPoolSize=100000 .. warning:: Avoid modifying :parameter:`ingressAdmissionControllerTicketPoolSize` unless directed by MongoDB engineers. This setting has major implications across both WiredTiger and MongoDB. Logging Parameters ~~~~~~~~~~~~~~~~~~ .. parameter:: logLevel |both| *Default*: 0 (informational) Specify an integer between ``0`` and ``5`` signifying the verbosity of the :ref:`logging `, where ``5`` is the most verbose. [#log-message]_ .. include:: /includes/fact-runtime-startup-parameter The following example sets the :parameter:`logLevel` to ``2``: .. code-block:: javascript db.adminCommand( { setParameter: 1, logLevel: 2 } ) .. seealso:: - :parameter:`logComponentVerbosity` - :setting:`systemLog.verbosity` .. [#log-message] .. include:: /includes/extracts/4.2-changes-debug-log-message.rst .. parameter:: logComponentVerbosity |both| *Default*: 0 Sets the verbosity levels of various :ref:`components ` for :doc:`log messages `. The verbosity level determines the amount of :ref:`Informational and Debug ` messages MongoDB outputs. [#log-message2]_ .. include:: /includes/log-verbosity-levels.rst For a component, you can also specify ``-1`` to inherit the parent's verbosity level. To specify the verbosity level, use a document similar to the following: .. code-block:: none { verbosity: , : { verbosity: }, : { verbosity: , : { verbosity: } }, ... } For the components, you can specify just the ``: `` in the document, unless you are setting both the parent verbosity level and that of the child component(s) as well: .. code-block:: none { verbosity: , : , : { verbosity: , : } ... } The top-level ``verbosity`` field corresponds to :setting:`systemLog.verbosity` which sets the default level for all components. The default value of :setting:`systemLog.verbosity` is ``0``. The components correspond to the following settings: .. include:: /includes/list-log-component-setting-correspondence.rst Unless explicitly set, the component has the verbosity level of its parent. For example, ``storage`` is the parent of ``storage.journal``. That is, if you specify a :setting:`storage ` verbosity level, this level also applies to: - :setting:`storage.journal ` components *unless* you specify the verbosity level for :setting:`storage.journal `. - :setting:`storage.recovery ` components *unless* you specify the verbosity level for :setting:`storage.recovery `. .. include:: /includes/fact-runtime-startup-parameter For example, the following sets the :setting:`default verbosity level ` to ``1``, the :setting:`query ` to ``2``, the :setting:`storage ` to ``2``, and the :setting:`storage.journal ` to ``1``. .. code-block:: javascript db.adminCommand( { setParameter: 1, logComponentVerbosity: { verbosity: 1, query: { verbosity: 2 }, storage: { verbosity: 2, journal: { verbosity: 1 } } } } ) You can also set parameter :parameter:`logComponentVerbosity` at startup time, passing the verbosity level document as a string. .. code-block:: bash mongod --setParameter "logComponentVerbosity={command: 3}" :binary:`~bin.mongosh` also provides the :method:`db.setLogLevel()` to set the log level for a single component. For various ways to set the log verbosity level, see :ref:`log-messages-configure-verbosity`. .. [#log-message2] .. include:: /includes/extracts/4.2-changes-debug-log-message.rst .. parameter:: maxLogSizeKB |both| *Type*: non-negative integer *Default*: 10 Specifies the maximum size, in kilobytes, for an individual attribute field in a log entry; attributes exceeding this limit are truncated. Truncated attribute fields print field content up to the :parameter:`maxLogSizeKB` limit and excise field content past that limit, retaining valid JSON formatting. Log entries that contain truncated attributes append a ``truncated`` object to the end of the log entry. See :ref:`log message truncation ` for more information. A value of ``0`` disables truncation entirely. Negative values for this parameter are not valid. .. warning:: Using a large value, or disabling truncation with a value of ``0``, may adversely affect system performance and negatively impact database operations. .. include:: /includes/fact-runtime-startup-parameter The following example sets the maximum log line size to ``20`` kilobytes: .. code-block:: bash mongod --setParameter maxLogSizeKB=20 .. parameter:: profileOperationResourceConsumptionMetrics |mongod-only| *Type*: boolean *Default*: false Flag that determines whether operations collect resource consumption metrics and report them in the slow query logs. If you enable :ref:`profiling `, these metrics are also included. If set to ``true``, running the :dbcommand:`explain` command returns :ref:`operationMetrics ` when the verbosity is ``executionStats`` or higher. .. include:: /includes/fact-startup-parameter .. parameter:: quiet |both| Sets quiet logging mode. If ``1``, :binary:`~bin.mongod` will go into a quiet logging mode which will not log the following events/activities: - connection events; - the :dbcommand:`drop` command, the :dbcommand:`dropIndexes` command, the :dbcommand:`validate` command; and - replication synchronization activities. .. include:: /includes/fact-runtime-startup-parameter Consider the following example which sets the ``quiet`` parameter to ``1``: .. code-block:: javascript db.adminCommand( { setParameter: 1, quiet: 1 } ) .. seealso:: :setting:`systemLog.quiet` .. parameter:: redactClientLogData |both| *Type*: boolean .. include:: /includes/fact-enterprise-only-admonition.rst Configure the :binary:`~bin.mongod` or :binary:`~bin.mongos` to redact any message accompanying a given log event before logging. This prevents the program from writing potentially sensitive data stored on the database to the diagnostic log. Metadata such as error or operation codes, line numbers, and source file names are still visible in the logs. Use :parameter:`redactClientLogData` in conjunction with :doc:`/core/security-encryption-at-rest` and :doc:`/core/security-transport-encryption` to assist compliance with regulatory requirements. To enable log redaction at startup, you can either: - Start :binary:`mongod` with the :option:`--redactClientLogData ` option: .. code-block:: javascript mongod --redactClientLogData - Set the :setting:`security.redactClientLogData` option in the :ref:`configuration file `: .. code-block:: yaml security: redactClientLogData: true ... You can't use the :option:`--setParameter ` option to set :parameter:`redactClientLogData` at startup. To enable log redaction on a running ``mongod`` or ``mongos``, use the following command: .. code-block:: javascript db.adminCommand( { setParameter: 1, redactClientLogData : true } ) .. seealso:: :setting:`security.redactClientLogData` .. parameter:: redactEncryptedFields .. versionadded:: 6.1.0 |both| *Type*: boolean *Default*: ``true`` Configures :program:`mongod` and :program:`mongos` to redact field values of encrypted :bsontype:`Binary` data from all :ref:`log messages `. - If the :parameter:`redactClientLogData` parameter or the :setting:`security.redactClientLogData` setting is set to ``false`` and ``redactEncryptedFields`` is set to ``true`` (the default), encrypted fields are redacted from all log messages. - If the :parameter:`redactClientLogData` parameter or :setting:`security.redactClientLogData` setting is set to ``true``, all fields are redacted, regardless of the ``redactEncryptedFields`` setting. .. include:: /includes/fact-runtime-startup-parameter .. parameter:: traceExceptions |both| Configures :binary:`~bin.mongod` to log full source code stack traces for every database and socket C++ exception, for use with debugging. If ``true``, :binary:`~bin.mongod` will log full stack traces. .. include:: /includes/fact-runtime-parameter Consider the following example which sets the ``traceExceptions`` to ``true``: .. code-block:: javascript db.adminCommand( { setParameter: 1, traceExceptions: true } ) .. seealso:: :setting:`systemLog.traceAllExceptions` .. parameter:: suppressNoTLSPeerCertificateWarning |both| *Type*: boolean *Default*: false By default, a :binary:`~bin.mongod` or :binary:`~bin.mongos` with :ref:`TLS/SSL enabled ` and ``net.ssl.allowConnectionsWithoutCertificates`` : ``true`` lets clients connect without providing a certificate for validation while logging an warning. Set ``suppressNoTLSPeerCertificateWarning`` to ``1`` or ``true`` to suppress those warnings. .. include:: /includes/fact-startup-parameter The following operation sets ``suppressNoTLSPeerCertificateWarning`` to ``true``: .. code-block:: bash db.adminCommand( { setParameter: 1, suppressNoTLSPeerCertificateWarning: true} ) .. _param-connection-health-metric-logs: .. parameter:: enableDetailedConnectionHealthMetricLogLines .. versionadded:: 7.0 |both| *Type*: boolean *Default*: true Determines whether to enable specific log messages related to cluster connection health metrics. If :parameter:`enableDetailedConnectionHealthMetricLogLines` is set to ``false``, the following log messages are turned off, but MongoDB still collects data on the cluster connection health metrics: .. list-table:: :header-rows: 1 :widths: 30 70 * - Log Message - Description * - Accepted TLS connection from peer - Indicates that the server successfully parsed the peer certificate during the TLS handshake with an accepted ingress connection. * - Ingress TLS handshake complete - Indicates that the TLS handshake with an ingress connection is complete. * - Hello completed - Indicates that the initial connection handshake completed on an incoming client connection. MongoDB displays the log message only with the first ``hello`` command. * - Auth metrics report - Specifies the completion of a step in the authentication conversation. * - Received first command on ingress connection since session start or auth handshake - Indicates that an ingress connection received the first command that is not part of the handshake. * - Slow network response send time - Indicates that the time spent, in milliseconds, to send the response back to the client over an ingress connection takes more time than the duration defined by the ``slowMS`` server parameter. * - Completed client-side verification of OCSP request - If the peer doesn't include an :abbr:`OCSP (Online Certificate Status Protocol)` response to the TLS handshake when an egress TLS connection is established, the server must send an OCSP request to the certificate authority. MongoDB writes this log message when the certificate authority receives the OCSP response. * - Slow connection establishment - Indicates that the time taken to send a response back to the client over an ingress connection takes longer than the threshold specified with the :parameter:`slowConnectionThresholdMillis` parameter. MongoDB also emits this log message when the connection establishment times out. * - Operation timed out while waiting to acquire connection - Indicates that an operation timed out while waiting to acquire an egress connection. * - Acquired connection for remote operation and completed writing to wire - Indicates that the server took one millisecond or longer to write an outgoing request on an egress connection, counting from the instant when the connection establishes. .. include:: /includes/fact-runtime-startup-parameter .. _param-ftdc: Diagnostic Parameters ~~~~~~~~~~~~~~~~~~~~~ To facilitate analysis of the MongoDB server behavior by MongoDB engineers, MongoDB logs server statistics to diagnostic files at periodic intervals. For :binary:`~bin.mongod`, the diagnostic data files are stored in the ``diagnostic.data`` directory under the :binary:`~bin.mongod` instance's ``--dbpath`` or :setting:`storage.dbPath`. For :binary:`~bin.mongos`, the diagnostic data files, by default, are stored in a directory under the :binary:`~bin.mongos` instance's ``--logpath`` or :setting:`systemLog.path` directory. The diagnostic data directory is computed by truncating the logpath's file extension(s) and concatenating ``diagnostic.data`` to the remaining name. For example, if :binary:`~bin.mongos` has ``--logpath /var/log/mongodb/mongos.log.201708015``, then the diagnostic data directory is ``/var/log/mongodb/mongos.diagnostic.data/`` directory. To specify a different diagnostic data directory for :binary:`~bin.mongos`, set the :parameter:`diagnosticDataCollectionDirectoryPath` parameter. The following parameters support diagnostic data capture (FTDC): .. note:: The default values for the diagnostic data capture interval and the maximum sizes are chosen to provide useful data to MongoDB engineers with minimal impact on performance and storage size. Typically, these values will only need modifications as requested by MongoDB engineers for specific diagnostic purposes. .. parameter:: diagnosticDataCollectionEnabled |both| *Type*: boolean *Default*: true Determines whether to enable the collecting and logging of data for diagnostic purposes. Diagnostic logging is enabled by default. .. include:: /includes/fact-runtime-startup-parameter For example, the following disables the diagnostic collection: .. code-block:: bash mongod --setParameter diagnosticDataCollectionEnabled=false .. parameter:: diagnosticDataCollectionDirectoryPath |mongos-only| *Type*: String .. warning:: If :ref:`Full Time Diagnostic Data Capture (FTDC) ` is disabled with :parameter:`diagnosticDataCollectionEnabled` or if :setting:`systemLog.destination` is set to ``syslog``, you must restart :binary:`~bin.mongos` after setting ``diagnosticDataCollectionDirectoryPath``. Specify the directory for the diagnostic directory for :binary:`~bin.mongos`. If the directory does not exist, :binary:`~bin.mongos` creates the directory. If unspecified, the diagnostic data directory is computed by truncating the :binary:`~bin.mongos` instance's ``--logpath`` or :setting:`systemLog.path` file extension(s) and concatenating ``diagnostic.data``. For example, if :binary:`~bin.mongos` has ``--logpath /var/log/mongodb/mongos.log.201708015``, then the diagnostic data directory is ``/var/log/mongodb/mongos.diagnostic.data/``. If the :binary:`~bin.mongos` cannot create the specified directory, the diagnostic data capture is disabled for that instance. :binary:`~bin.mongos` may not be able to create the specified directory if a file with the same name already exists in the path or if the process does not have permissions to create the directory. .. include:: /includes/fact-runtime-startup-parameter .. parameter:: diagnosticDataCollectionDirectorySizeMB |both| *Type*: integer *Default*: ``200`` (``400`` in sharded clusters) Specifies the maximum size, in megabytes, of the ``diagnostic.data`` directory. If directory size exceeds this number, the oldest diagnostic files in the directory are automatically deleted based on the timestamp in the file name. .. versionchanged:: 8.0 ``diagnosticDataCollectionDirectorySizeMB`` has a default value of 400 MB for :program:`mongos` and :program:`mongod` instances used in sharded clusters. ``mongod`` instances used in replica set or as standalone servers have a default value of 200 MB. .. include:: /includes/fact-runtime-startup-parameter For example, the following sets the maximum size of the directory to ``250`` megabytes: .. code-block:: bash mongod --setParameter diagnosticDataCollectionDirectorySizeMB=250 The minimum value for :parameter:`diagnosticDataCollectionDirectorySizeMB` is ``10`` megabytes. :parameter:`diagnosticDataCollectionDirectorySizeMB` must be greater than maximum diagnostic file size :parameter:`diagnosticDataCollectionFileSizeMB`. .. parameter:: diagnosticDataCollectionFileSizeMB |both| *Type*: integer *Default*: 10 Specifies the maximum size, in megabytes, of each diagnostic file. If the file exceeds the maximum file size, MongoDB creates a new file. .. include:: /includes/fact-runtime-startup-parameter For example, the following sets the maximum size of each diagnostic file to ``20`` megabytes: .. code-block:: bash mongod --setParameter diagnosticDataCollectionFileSizeMB=20 The minimum value for :parameter:`diagnosticDataCollectionFileSizeMB` is ``1`` megabyte. .. parameter:: diagnosticDataCollectionPeriodMillis |both| *Type*: integer *Default*: 1000 Specifies the interval, in milliseconds, at which to collect diagnostic data. .. include:: /includes/fact-runtime-startup-parameter For example, the following sets the interval to ``5000`` milliseconds or 5 seconds: .. code-block:: bash mongod --setParameter diagnosticDataCollectionPeriodMillis=5000 The minimum value for :parameter:`diagnosticDataCollectionPeriodMillis` is ``100`` milliseconds. Replication and Consistency ~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. parameter:: connectTimeoutMs |both| *Type*: integer *Default*: 10000 Sets the connection timeout, in milliseconds, for the :ref:`replica set monitor `. This parameter is only available at startup. If you set this parameter, it must be greater than or equal to 500. The following example sets ``connectTimeoutMs`` for a ``mongod`` instance to 700 milliseconds: .. code-block:: bash mongod --setParameter connectTimeoutMs=700 .. parameter:: disableSplitHorizonIPCheck .. versionadded:: 5.0.0 |both| *Type*: boolean *Default*: false .. include:: /includes/fact-split-horizon-binding.rst To allow configuration changes using IP addresses, set ``disableSplitHorizonIPCheck=true`` using the command line: .. code-block:: javascript /usr/local/bin/mongod --setParameter disableSplitHorizonIPCheck=true -f /etc/mongod.conf .. include:: /includes/fact-startup-parameter .. code-block:: javascript setParameter: disableSplitHorizonIPCheck: true .. parameter:: enableOverrideClusterChainingSetting .. versionadded:: 5.0.2 |both| *Type*: boolean *Default*: false If :parameter:`enableOverrideClusterChainingSetting` is ``true``, replica set :term:`secondary` members can replicate data from other secondary members even if :rsconf:`settings.chainingAllowed` is ``false``. .. include:: /includes/fact-startup-parameter For example, to set the :parameter:`enableOverrideClusterChainingSetting` for a :binary:`~bin.mongod` instance to ``true``: .. code-block:: bash mongod --setParameter enableOverrideClusterChainingSetting=true .. parameter:: heartBeatFrequencyMs |both| *Type*: integer *Default*: 10000 When :parameter:`replicaSetMonitorProtocol` is set to ``'sdam'``, ``heartBeatFrequencyMs`` determines how long, in milliseconds, to wait between :dbcommand:`hello` requests. When :parameter:`replicaSetMonitorProtocol` is set to ``'streamable'``, ``heartBeatFrequencyMs`` determines how long, in milliseconds, to wait between :dbcommand:`hello` round trip time (RTT) measurements. RTT measurements are used in :ref:`server selection `. This parameter is only available at startup. If you set this parameter, it must be greater than or equal to 500. The following example sets ``heartBeatFrequencyMs`` in a ``mongod`` instance to 700 milliseconds: .. code-block:: bash mongod --setParameter heartBeatFrequencyMs=700 .. parameter:: logicalSessionRefreshMillis |both| *Type*: integer *Default*: 300000 (5 minutes) The interval (in milliseconds) at which the cache refreshes its logical session records against the main session store. .. include:: /includes/fact-startup-parameter For example, to set the :parameter:`logicalSessionRefreshMillis` for a :binary:`~bin.mongod` instance to 10 minutes: .. code-block:: bash mongod --setParameter logicalSessionRefreshMillis=600000 .. parameter:: localLogicalSessionTimeoutMinutes |both| *Type*: integer *Default*: 30 .. warning:: For testing purposes only This parameter is intended for testing purposes only and not for production use. .. include:: /includes/fact-session-timeout.rst This parameter applies only to the instance on which it is set. To set this parameter on replica sets and sharded clusters, you must specify the same value on every member; otherwise, sessions will not function properly. .. include:: /includes/fact-startup-parameter For example, to set the :parameter:`localLogicalSessionTimeoutMinutes` for a test :binary:`~bin.mongod` instance to 20 minutes: .. code-block:: bash mongod --setParameter localLogicalSessionTimeoutMinutes=20 .. parameter:: localThresholdMs |both| *Type*: integer *Default*: 15 Defines the length of the latency window used in :ref:`server selection ` in milliseconds. This parameter is only available at startup. If you set this parameter, it must be greater than or equal to 0. The following example sets ``localThresholdMs`` for a ``mongod`` instance to 20 milliseconds: .. code-block:: bash mongod --setParameter localThresholdMs=20 .. parameter:: maxAcceptableLogicalClockDriftSecs |both| *Type*: integer *Default*: 31536000 (1 year) The maximum amount by which the current cluster time can be advanced; specifically, :parameter:`maxAcceptableLogicalClockDriftSecs` is the maximum difference between the new value of the cluster time and the current cluster time. Cluster time is a logical time used for ordering of operations. You cannot advance the cluster time to a new value if the new cluster time differs from the current cluster time by more than :parameter:`maxAcceptableLogicalClockDriftSecs`. .. include:: /includes/fact-startup-parameter For example, to set the :parameter:`maxAcceptableLogicalClockDriftSecs` for a :binary:`~bin.mongod` instance to 15 minutes: .. code-block:: bash mongod --setParameter maxAcceptableLogicalClockDriftSecs=900 .. parameter:: maxSessions |both| *Type*: integer *Default*: 1000000 The maximum number of sessions that can be cached. .. include:: /includes/fact-startup-parameter For example, to set the :parameter:`maxSessions` for a :binary:`~bin.mongod` instance to 1000: .. code-block:: bash mongod --setParameter maxSessions=1000 .. parameter:: oplogBatchDelayMillis .. versionadded:: 6.0 |both| *Type*: integer *Default*: 0 The number of milliseconds to delay applying batches of oplog operations on secondary nodes. By default, ``oplogBatchDelayMillis`` is ``0``, meaning oplog batches are applied with no delay. When there is no delay, MongoDB may apply frequent, small oplog batches to secondaries. Increasing ``oplogBatchDelayMillis`` causes MongoDB to apply oplog batches less frequently on secondaries, with each batch containing larger amounts of data. This reduces :abbr:`IOPS (Input/Output Operations Per Second)` on secondaries, but adds latency for writes with write concern :writeconcern:`"majority"`. .. include:: /includes/fact-startup-parameter For example, run the following command to set the ``oplogBatchDelayMillis`` for a :binary:`~bin.mongod` instance to 20 milliseconds: .. code-block:: bash mongod --setParameter oplogBatchDelayMillis=20 .. parameter:: periodicNoopIntervalSecs |mongod-only| *Type*: integer *Default*: 10 The duration in seconds between :term:`noop` writes on each individual node. .. include:: /includes/fact-startup-parameter .. note:: To modify this value for a :atlas:`MongoDB Atlas ` cluster, you must contact :atlas:`Atlas Support `. The following example sets the ``periodicNoopIntervalSecs`` to 1 second at startup: .. code-block:: javascript mongod --setParameter periodicNoopIntervalSecs=1 .. parameter:: replicaSetMonitorProtocol |both| *Type*: string *Default*: "streamable" Determines which replica set monitor protocol to use. You can set this parameter to ``"streamable"``, which is compliant with `Server Discovery and Monitoring (SDAM) `__ specification and allows for constant :dbcommand:`hello` requests. You can also set this parameter to ``"sdam"``, which is compliant with SDAM specification. This parameter is only available at startup. The following example sets ``replicaSetMonitorProtocol`` to ``"sdam"`` on a ``mongod`` instance: .. code-block:: bash mongod --setParameter replicaSetMonitorProtocol='sdam' .. parameter:: storeFindAndModifyImagesInSideCollection .. versionadded:: 5.0 |both| *Type*: boolean *Default*: true Determines whether the temporary documents required for :ref:`retryable ` :dbcommand:`findAndModify` commands are stored in the *side* collection (``config.image_collection``). If ``storeFindAndModifyImagesInSideCollection`` is: - ``true``, the temporary documents are stored in the side collection. - ``false``, the temporary documents are stored in the :ref:`replica set oplog `. Keep ``storeFindAndModifyImagesInSideCollection`` set to ``true`` if you: - Have a large :ref:`retryable ` :dbcommand:`findAndModify` workload. - Require more temporary document space for :ref:`retryable ` :dbcommand:`findAndModify` commands than is available in the :ref:`replica set oplog `. .. note:: :term:`Secondaries ` may experience increased CPU usage when ``storeFindAndModifyImagesInSideCollection`` is ``true``. .. include:: /includes/fact-runtime-startup-parameter For example, to set ``storeFindAndModifyImagesInSideCollection`` to ``false`` during startup: .. code-block:: bash mongod --setParameter storeFindAndModifyImagesInSideCollection=false During run time, you can also set the parameter with the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, storeFindAndModifyImagesInSideCollection: false } ) .. parameter:: TransactionRecordMinimumLifetimeMinutes |mongod-only| *Type*: integer *Default*: 30 The minimum lifetime a transaction record exists in the :data:`~config.transactions` collection before the record becomes eligible for cleanup. .. include:: /includes/fact-startup-parameter For example, to set the :parameter:`TransactionRecordMinimumLifetimeMinutes` for a :binary:`~bin.mongod` instance to 20 minutes: .. code-block:: bash mongod --setParameter TransactionRecordMinimumLifetimeMinutes=20 .. seealso:: :parameter:`localLogicalSessionTimeoutMinutes` .. parameter:: enableFlowControl |both| *Type*: boolean *Default*: true Enables or disables the mechanism that controls the rate at which the primary applies its writes with the goal of keeping the secondary members' :data:`majority committed ` lag under a configurable maximum value. .. include:: /includes/fact-runtime-startup-parameter .. parameter:: flowControlTargetLagSeconds |both| *Type*: integer *Default*: 10 The target maximum :data:`majority committed ` lag when running with flow control. When flow control is enabled, the mechanism attempts to keep the :data:`majority committed ` lag under the specified seconds. The parameter has no effect if flow control is disabled. The specified value must be greater than 0. In general, the default settings should suffice; however, if modifying from the default value, decreasing, rather than increasing, the value may prove to be more useful. .. include:: /includes/fact-runtime-startup-parameter .. parameter:: flowControlWarnThresholdSeconds |both| *Type*: integer *Default*: 10 The amount of time to wait to log a warning once the flow control mechanism detects the majority commit point has not moved. The specified value must be greater than or equal to 0, with 0 to disable warnings. .. include:: /includes/fact-runtime-startup-parameter .. parameter:: initialSyncTransientErrorRetryPeriodSeconds |both| *Type*: integer *Default*: 86400 The amount of time in seconds a secondary performing initial sync attempts to resume the process if interrupted by a transient network error. The default value is equivalent to 24 hours. .. include:: /includes/fact-runtime-startup-parameter .. parameter:: initialSyncSourceReadPreference |mongod-only| *Type*: String The preferred source for performing :ref:`initial sync `. Specify one of the following read preference modes: - :readmode:`primary` - :readmode:`primaryPreferred` (Default for voting replica set members) - :readmode:`secondary` - :readmode:`secondaryPreferred` - :readmode:`nearest` (Default for newly added *or* non-voting replica set members) If the replica set has disabled :rsconf:`chaining `, the default :parameter:`initialSyncSourceReadPreference` read preference mode is :readmode:`primary`. You cannot specify a tag set or ``maxStalenessSeconds`` to :parameter:`initialSyncSourceReadPreference`. If the :binary:`~bin.mongod` cannot find a sync source based on the specified read preference, it logs an error and restarts the initial sync process. The :binary:`~bin.mongod` exits with an error if it cannot complete the initial sync process after ``10`` attempts. For more information on sync source selection, see :ref:`replica-set-initial-sync-source-selection`. :parameter:`initialSyncSourceReadPreference` takes precedence over the replica set's :rsconf:`settings.chainingAllowed` setting when selecting an initial sync source. After a replica set member successfully completes initial sync, it defers to the value of :rsconf:`~settings.chainingAllowed` when selecting a replication sync source. .. include:: /includes/fact-startup-parameter .. parameter:: initialSyncMethod .. versionadded:: 5.2 |mongod-only| *Type*: String *Default*: ``logical`` Available only in MongoDB Enterprise. Method used for :ref:`initial sync `. Set to ``logical`` to use :ref:`logical initial sync `. Set to ``fileCopyBased`` to use :ref:`file copy based initial sync `. This parameter only affects the sync method for the member on which it is specified. Setting this parameter on a single replica set member does not affect the sync method of any other replica set members. .. include:: /includes/fact-startup-parameter .. parameter:: maxNumSyncSourceChangesPerHour |both| .. versionadded:: 5.0 *Type*: integer *Default*: 3 :ref:`Sync sources ` are evaluated each time a sync source is updated and each time a node fetches a batch of oplog entries. If there are more than ``maxNumSyncSourceChangesPerHour`` source changes in an hour, the node temporarily stops re-evaluating that sync source. If this parameter is set with a high value, the node may make unnecessary source changes. This parameter will not prevent a node from starting to sync from another node if it doesn't have a sync source. The node will re-evaluate if a sync source becomes invalid. Similarly, if the primary changes and chaining is disabled, the node will update to sync from the new primary. .. include:: /includes/fact-runtime-startup-parameter .. parameter:: oplogFetcherUsesExhaust |mongod-only| *Type*: boolean *Default*: true Enables or disables :ref:`streaming replication `. Set the value to ``true`` to enable streaming replication. Set the value to ``false`` to disable streaming replication. If disabled, secondaries fetch batches of :ref:`oplog ` entries by issuing a request to their *sync from* source and waiting for a response. This requires a network roundtrip for each batch of :doc:`oplog ` entries. .. include:: /includes/fact-startup-parameter .. parameter:: oplogInitialFindMaxSeconds |mongod-only| *Type*: integer *Default*: 60 Maximum time in seconds for a member of a :term:`replica set` to wait for the :dbcommand:`find` command to finish during :ref:`data synchronization `. .. include:: /includes/fact-runtime-startup-parameter .. parameter:: replWriterThreadCount |mongod-only| *Type*: integer *Default*: 16 Maximum number of threads to use to apply replicated operations in parallel. Values can range from 1 to 256 inclusive. However, the maximum number of threads used is capped at twice the number of available cores. .. include:: /includes/fact-startup-parameter .. seealso:: :parameter:`replWriterMinThreadCount` .. parameter:: replWriterMinThreadCount .. versionadded:: 5.0 |mongod-only| *Type*: integer *Default*: 0 Minimum number of threads to use to apply replicated operations in parallel. Values can range from 0 to 256 inclusive. You can only set :parameter:`replWriterMinThreadCount` at startup and cannot change this setting with the :dbcommand:`setParameter` command. Parallel application of replication operations uses up to :parameter:`replWriterThreadCount` threads. If :parameter:`replWriterMinThreadCount` is configured with a value less than :parameter:`replWriterThreadCount`, the thread pool will timeout idle threads until the total count of threads in the thread pool is equal to :parameter:`replWriterMinThreadCount`. :parameter:`replWriterMinThreadCount` must be configured with a value that is less than or equal to :parameter:`replWriterThreadCount`. .. include:: /includes/fact-startup-parameter .. parameter:: rollbackTimeLimitSecs |mongod-only| *Type*: 64-bit integer *Default*: 86400 (1 day) Maximum age of data that can be rolled back. Negative values for this parameter are not valid. If the time between the end of the to-be-rolledback instance's oplog and the first operation after the common point (the last point where the source node and the to-be-rolledback node had the same data) exceeds this value, the rollback will fail. To effectively have an unlimited rollback period, set the value to ``2147483647`` which is the maximum value allowed and equivalent to roughly 68 years. .. include:: /includes/fact-runtime-startup-parameter .. parameter:: waitForSecondaryBeforeNoopWriteMS |mongod-only| *Type*: integer *Default*: 10 The length of time (in milliseconds) that a secondary must wait if the ``afterClusterTime`` is greater than the last applied time from the oplog. After the ``waitForSecondaryBeforeNoopWriteMS`` passes, if the ``afterClusterTime`` is still greater than the last applied time, the secondary makes a no-op write to advance the last applied time. .. include:: /includes/fact-runtime-startup-parameter The following example sets the :parameter:`waitForSecondaryBeforeNoopWriteMS` to 20 milliseconds: .. code-block:: bash mongod --setParameter waitForSecondaryBeforeNoopWriteMS=20 During run time, you can also set the parameter with the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, waitForSecondaryBeforeNoopWriteMS: 20 } ) .. parameter:: createRollbackDataFiles |mongod-only| *Type*: boolean *Default*: true Flag that determines whether MongoDB creates :ref:`rollback files ` that contains documents affected during a rollback. By default, :parameter:`createRollbackDataFiles` is ``true`` and MongoDB creates the rollback files. .. include:: /includes/fact-runtime-startup-parameter The following example sets :parameter:`createRollbackDataFiles` to false so that the rollback files are not created: .. code-block:: javascript mongod --setParameter createRollbackDataFiles=false During run time, you can also set the parameter with the :dbcommand:`setParameter` command: .. code-block:: bash db.adminCommand( { setParameter: 1, createRollbackDataFiles: false } ) For more information, see :ref:`rollback-data-files`. .. parameter:: replBatchLimitBytes |both| *Default*: 104857600 (100MB) Sets the maximum oplog application batch size in bytes. Values can range from 16777216 (16MB) to 104857600 (100MB) inclusive. .. include:: /includes/fact-runtime-startup-parameter The following example sets :parameter:`replBatchLimitBytes` to 64 MB to limit the oplog application batch size: .. code-block:: javascript mongod --setParameter replBatchLimitBytes=67108864 During run time, you can also set the parameter with the :dbcommand:`setParameter` command: .. code-block:: bash db.adminCommand( { setParameter: 1, replBatchLimitBytes: 64 * 1024 * 1024 } ) .. parameter:: mirrorReads |mongod-only| *Type*: Document *Default*: ``{ samplingRate: 0.01, maxTimeMS: 1000 }`` Specifies the settings for :ref:`mirrored reads ` for the :binary:`~bin.mongod` instance. The settings only take effect when the member is a primary. The parameter :parameter:`mirrorReads` takes a JSON document with the following fields: .. list-table:: :header-rows: 1 :widths: 25 75 * - Field - Description * - ``samplingRate`` - The sampling rate used to mirror a subset of :ref:`operations that support mirroring ` to a subset of electable (specifically, :rsconf:`priority greater than 0 `) secondaries. That is, the primary mirrors reads to each electable secondary at the specified sampling rate. Valid values are: .. list-table:: :widths: 40 60 * - ``0.0`` - Turns off mirroring. * - ``1.0`` - The primary mirrors all :ref:`operations that supports mirroring ` to each electable secondary. * - Number between ``0.0`` and ``1.0`` (exclusive) - The primary randomly samples each electable secondary at the specified rate to be sent mirrored reads. For example, given a replica set with a primary and two electable secondaries and a sampling rate of ``0.10``, the primary mirrors reads to each electable secondary at the sampling rate of 10 percent such that one read may be mirrored to one secondary and not to the other or to both or to neither. That is, if the primary receives ``100`` operations that can be mirrored, the sampling rate of ``0.10`` may result in ``8`` reads being mirrored to one secondary and ``13`` reads to the other or ``10`` to each, etc. The default value is ``0.01``. * - ``maxTimeMS`` - The maximum time in milliseconds for the mirrored reads. The default value is ``1000``. The ``maxTimeMS`` for the mirrored reads is separate from the ``maxTimeMS`` of the original read being mirrored. .. include:: /includes/fact-runtime-startup-parameter If you specify from the configuration file or on the command line, **enclose the** ``mirrorReads`` **document in quotes**. For example, the following sets the mirror reads sampling rate to ``0.10`` from the command line: .. code-block:: bash mongod --setParameter mirrorReads='{ samplingRate: 0.10 }' Or, to specify in a configuration file: .. code-block:: yaml setParameter: mirrorReads: '{samplingRate: 0.10}' Or if using the :dbcommand:`setParameter` command in a :binary:`~bin.mongosh` session that is connected to a running :binary:`~bin.mongod`, do **not** enclose the document in quotes: .. code-block:: javascript db.adminCommand( { setParameter: 1, mirrorReads: { samplingRate: 0.10 } } ) .. parameter:: allowMultipleArbiters .. versionadded:: 5.3 |mongod-only| *Type*: boolean *Default*: false Specifies whether the replica set allows the use of multiple arbiters. The use of multiple arbiters is not recommended: - Multiple arbiters prevent the reliable use of the majority write concern. MongoDB counts arbiters in calculating a membership majority, but arbiters do not store data. With the inclusion of multiple arbiters, it's possible for a majority write operation to return success before the write replicates to a majority of data bearing nodes. - Multiple arbiters allow replica sets to accept writes even when the replica set doesn't have sufficient secondaries for data replication. For more information, see :ref:`Concerns with Multiple Arbiters `. .. include:: /includes/fact-startup-parameter .. include:: /includes/setParameter-allowMultipleArbiters.rst Sharding Parameters ~~~~~~~~~~~~~~~~~~~ .. _ask-cdss-param: .. parameter:: analyzeShardKeyCharacteristicsDefaultSampleSize .. versionadded:: 7.0 |mongod-only| *Type*: integer *Default*: 10000000 If ``sampleRate`` and ``sampleSize`` are not set when you run ``analyzeShardKey``, specifies the number of documents to sample when calculating shard key characteristics metrics. Must be greater than ``0``. .. include:: /includes/fact-runtime-startup-parameter This example sets ``analyzeShardKeyCharacteristicsDefaultSampleSize`` to ``10000`` at startup: .. code-block:: bash mongod --setParameter analyzeShardKeyCharacteristicsDefaultSampleSize=10000 During run time, you can set or modify the parameter with the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, analyzeShardKeyCharacteristicsDefaultSampleSize: 10000 } ) .. _ask-nmcv-param: .. parameter:: analyzeShardKeyNumMostCommonValues .. versionadded:: 7.0 |mongod-only| *Type*: integer *Default*: 5 Specifies the number of most common shard key values to return. If the collection contains fewer unique shard keys than this value, ``analyzeShardKeyNumMostCommonValues`` returns that number of most common values. Must be greater than ``0`` and less than or equal to ``1000``. .. include:: /includes/fact-runtime-startup-parameter This example sets ``analyzeShardKeyNumMostCommonValues`` to ``3`` at startup: .. code-block:: bash mongod --setParameter analyzeShardKeyNumMostCommonValues=3 During run time, you can set or modify the parameter with the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, analyzeShardKeyNumMostCommonValues: 3 } ) .. parameter:: analyzeShardKeyNumRanges .. versionadded:: 7.0 |mongod-only| *Type*: integer *Default*: 100 Specifies the number of ranges to partition the shard key space into when calculating the :ref:`hotness ` of shard key ranges. Must be greater than ``0`` and less than or equal to ``10000``. .. include:: /includes/fact-runtime-startup-parameter This example sets ``analyzeShardKeyNumRanges`` to ``50`` at startup: .. code-block:: bash mongod --setParameter analyzeShardKeyNumRanges=50 During run time, you can set or modify the parameter with the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, analyzeShardKeyNumRanges: 50 } ) .. _ask-mcct-param: .. parameter:: analyzeShardKeyMonotonicityCorrelationCoefficientThreshold .. versionadded:: 7.0 |mongod-only| *Type*: double *Default*: 0.7 Specifies the ``RecordId`` correlation coefficient threshold used to determine if a shard key is monotonically changing in insertion order. Must be greater than ``0`` and less than or equal to ``1``. .. include:: /includes/fact-runtime-startup-parameter This example sets ``analyzeShardKeyMonotonicityCorrelationCoefficientThreshold`` to ``1`` at startup: .. code-block:: bash mongod --setParameter analyzeShardKeyMonotonicityCorrelationCoefficientThreshold=1 During run time, you can set or modify the parameter with the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, analyzeShardKeyMonotonicityCorrelationCoefficientThreshold: 1 } ) .. _automerger-params: .. parameter:: autoMergerIntervalSecs .. versionadded:: 7.0 |mongod-only| *Type*: integer *Default*: 3600 When {+auto-merge-upper+} is enabled, specifies the amount of time between {+auto-merge-action+} rounds, in seconds. The default value is 3600 seconds, or one hour. ``autoMergerIntervalSecs`` can only be set on config servers. .. include:: /includes/fact-runtime-startup-parameter This example sets ``autoMergerIntervalSecs`` to 7200 seconds, or two hours, at startup: .. code-block:: bash mongod --setParameter autoMergerIntervalSecs=7200 During run time, you can set or modify the parameter with the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, autoMergerIntervalSecs: 7200 } ) .. parameter:: autoMergerThrottlingMS .. versionadded:: 7.0 |mongod-only| *Type*: integer *Default*: 15000 When {+auto-merge-upper+} is enabled, specifies the minimum amount time between merges initiated by the {+auto-merge-upper+} on the same collection, in milliseconds. ``autoMergerThrottlingMS`` can only be set on config servers. .. include:: /includes/fact-runtime-startup-parameter This example sets ``autoMergerThrottlingMS`` to 60000 milliseconds, or one minute, at startup: .. code-block:: bash mongod --setParameter autoMergerThrottlingMS=60000 During run time, you can set or modify the parameter with the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, autoMergerThrottlingMS: 60000 } ) .. _balancer-sharding-params: .. parameter:: balancerMigrationsThrottlingMs .. versionadded:: 7.0 (*Also available starting in 6.3.1, 6.0.6, 5.0.18*) |mongod-only| *Type*: integer *Default*: 1000 Specifies the minimum amount of time between two consecutive balancing rounds. This allows you to throttle the balancing rate. This parameter only takes effect on config server nodes. .. include:: /includes/fact-runtime-startup-parameter This example sets ``balancerMigrationsThrottlingMs`` to 2000 milliseconds at startup: .. code-block:: bash mongod --setParameter balancerMigrationsThrottlingMs=2000 During run time, you can also set the parameter with the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, balancerMigrationsThrottlingMs: 2000 } ) .. parameter:: chunkDefragmentationThrottlingMS .. versionadded:: 5.3 |both| *Type*: integer *Default*: 0 Specifies the minimum time period (in milliseconds) between consecutive split and merge commands run by the :term:`balancer` when the :term:`chunks ` in a :term:`sharded ` collection are defragmented. :parameter:`chunkDefragmentationThrottlingMS` limits the rate of split and merge commands. .. include:: /includes/fact-runtime-startup-parameter The following example sets :parameter:`chunkDefragmentationThrottlingMS` to ``10`` milliseconds: .. code-block:: bash mongod --setParameter chunkDefragmentationThrottlingMS=10 During run time, you can also set the parameter with the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, chunkDefragmentationThrottlingMS: 10 } ) .. parameter:: disableResumableRangeDeleter |mongod-only| *Type*: boolean *Default*: false If set on a shard's primary, specifies if range deletion is paused on the shard. If set to ``true``, cleanup of :term:`ranges ` containing :term:`orphaned documents ` is paused. The shard can continue to donate chunks to other shards, but the donated documents will not be removed from this shard until you set this parameter to ``false``. This shard can continue to receive chunks from other shards as long as it does not have a pending range deletion task in the :data:`config.rangeDeletions` collection that overlaps with the incoming chunk's range. When :parameter:`disableResumableRangeDeleter` is ``true``, chunk migrations fail if :term:`orphaned documents ` exist on the recipient shard's primary in the same range as the incoming chunks. The parameter has no effect on the :binary:`~bin.mongod` if it is not the shard's primary. .. important:: If you set :parameter:`disableResumableRangeDeleter` parameter to ``true``, ensure that you apply it consistently for all members in the shard's replica set. In the event of a failover, this setting's value on the new primary dictates the behavior of the range deleter. .. include:: /includes/fact-startup-parameter .. code-block:: javascript mongod --setParameter disableResumableRangeDeleter=false .. parameter:: enableShardedIndexConsistencyCheck |mongod-only| *Type*: boolean *Default*: true If set on the config server's primary, enables or disables the index consistency check for sharded collections. The parameter has no effect on the :binary:`~bin.mongod` if it is not the config server's primary. .. include:: /includes/fact-runtime-startup-parameter The following example sets :parameter:`enableShardedIndexConsistencyCheck` to ``false`` for a config server primary: .. code-block:: javascript mongod --setParameter enableShardedIndexConsistencyCheck=false During run time, you can also set the parameter with the :dbcommand:`setParameter` command: .. code-block:: bash db.adminCommand( { setParameter: 1, enableShardedIndexConsistencyCheck: false } ) .. seealso:: - :parameter:`shardedIndexConsistencyCheckIntervalMS` parameter - :serverstatus:`shardedIndexConsistency` metrics returned by the :dbcommand:`serverStatus` command. .. parameter:: opportunisticSecondaryTargeting .. versionadded:: 6.1.0 |mongos-only| *Type*: boolean *Default*: ``false`` Determines whether ``mongos`` performs opportunistic reads against replica sets. When this parameter is set to ``true``, :program:`mongos` directs secondary reads to secondaries with active connections. It sends the request to the first secondary that accepts the connection. When this parameter is set to ``false``, :program:`mongos` holds secondary reads until it can establish a connection to a specific secondary, (except in the case of :ref:`hedged reads `). .. note:: Under certain workloads, opportunistic reads may trigger the opening of unnecessary connections from :program:`mongos` to :program:`mongod` and reduce overall performance. This parameter should not be enabled unless your application has a specific need for the feature. .. include:: /includes/fact-runtime-startup-parameter For example, to set ``opportunisticSecondaryTargeting`` during startup: .. code-block:: bash mongos --setParameter opportunisticSecondaryTargeting=true .. parameter:: shardedIndexConsistencyCheckIntervalMS |mongod-only| *Type*: integer *Default*: 600000 If set on the config server's primary, the interval, in milliseconds, at which the config server's primary checks the index consistency of sharded collections. The parameter has no effect on the :binary:`~bin.mongod` if it is not the config server's primary. .. include:: /includes/fact-startup-parameter For example, the following sets the interval at 300000 milliseconds (5 minutes) at startup: .. code-block:: javascript mongod --setParameter shardedIndexConsistencyCheckIntervalMS=300000 .. seealso:: - :parameter:`enableShardedIndexConsistencyCheck` parameter - :serverstatus:`shardedIndexConsistency` metrics returned by the :dbcommand:`serverStatus` command. .. parameter:: enableFinerGrainedCatalogCacheRefresh .. note:: Deprecated in 8.0 Starting in MongoDB 8.0, the parameter is deprecated and doesn't cause any changes or errors. |both| *Type*: boolean *Default*: true This parameter allows the catalog cache to be refreshed only if the shard needs to be refreshed. If disabled, any stale chunk will cause the entire chunk distribution for a collection to be considered stale and force all :ref:`routers ` who contact the shard to refresh their shard catalog cache. .. include:: /includes/fact-startup-parameter .. code-block:: bash mongod --setParameter enableFinerGrainedCatalogCacheRefresh=true mongos --setParameter enableFinerGrainedCatalogCacheRefresh=true .. seealso:: - :ref:`sharding-background` - :serverstatus:`shardingStatistics.catalogCache` .. parameter:: maxTimeMSForHedgedReads .. important:: .. include:: /includes/hedged-reads-deprecated.rst |mongos-only| *Type*: integer *Default*: 150 Specifies the maximum time limit (in milliseconds) for the :ref:`hedged read `. That is, the additional read sent to hedge the read operation uses the ``maxTimeMS`` value of :parameter:`maxTimeMSForHedgedReads` while the read operation that is being hedged uses the ``maxTimeMS`` value specified for the operation. .. include:: /includes/fact-runtime-startup-parameter For example, to set the limit to 200 milliseconds, you can issue the following during startup: .. code-block:: bash mongos --setParameter maxTimeMSForHedgedReads=200 Or if using the :dbcommand:`setParameter` command in a :binary:`~bin.mongosh` session that is connected to a running :binary:`~bin.mongos`: .. code-block:: javascript db.adminCommand( { setParameter: 1, maxTimeMSForHedgedReads: 200 } ) .. seealso:: - :parameter:`readHedgingMode` - :ref:`mongos-hedged-reads` .. parameter:: maxCatchUpPercentageBeforeBlockingWrites .. versionadded:: 5.0 |mongod-only| *Type*: integer *Default*: 10 For :dbcommand:`moveChunk` and :dbcommand:`moveRange` operations, specifies the maximum percentage of untrasferred data allowed by the migration protocol (expressed in percentage of the total chunk size) to transition from the ``catchup`` phase to the ``commit`` phase. Setting a higher catchup percentage can decrease the amount of time it takes for the migration to complete at the cost of increased latency during concurrent :method:`upsert ` and :method:`delete ` operations. .. include:: /includes/fact-startup-parameter Starting in MongoDB 7.1 (and 7.0.1), you can set the parameter during runtime. For example, to set the maximum percentage to 20, you can issue the following during startup: .. code-block:: bash mongod --setParameter maxCatchUpPercentageBeforeBlockingWrites=20 Starting in MongoDB 7.1 (and 7.0.1), you can set the parameter during runtime with the :dbcommand:`setParameter` command: .. code-block:: bash db.adminCommand( { setParameter: 1, maxCatchUpPercentageBeforeBlockingWrites: 20} ) .. seealso:: `Live Migration Protocol `__ .. parameter:: metadataRefreshInTransactionMaxWaitBehindCritSecMS .. versionadded:: 5.2 (*Also available starting in 5.1.0, 5.0.4*) |mongod-only| *Type*: integer *Default*: 500 Limits the time a shard waits for a critical section within a transaction. When a query accesses a shard, a :ref:`chunk migration ` or :ref:`DDL operation ` may already hold the critical section for the collection. If the query finds the critical section is taken, the shard waits until the critical section has been released. When the shard returns control to :binary:`mongos`, :binary:`mongos` retries the query. However, if a multi-shard transaction interacts with an operation that takes the critical section on multiple shards, the interaction can result in a distributed deadlock. :parameter:`metadataRefreshInTransactionMaxWaitBehindCritSecMS` limits the maximum time a shard waits within a transaction for the critical section to be released. To reduce the maximum wait time for the critical section within a transaction, lower the value of :parameter:`metadataRefreshInTransactionMaxWaitBehindCritSecMS`. .. warning:: If :parameter:`metadataRefreshInTransactionMaxWaitBehindCritSecMS` is too low, :binary:`mongos` could use all of its retry attempts and return an error. .. include:: /includes/fact-runtime-startup-parameter For example, to set :parameter:`metadataRefreshInTransactionMaxWaitBehindCritSecMS` to 400 milliseconds: .. code-block:: javascript db.adminCommand( { setParameter: 1, metadataRefreshInTransactionMaxWaitBehindCritSecMS: 400 } ) .. parameter:: queryAnalysisSamplerConfigurationRefreshSecs .. versionadded:: 7.0 .. versionchanged:: 7.0.1 |both| *Type*: integer *Default*: 10 Interval that a sampler (``mongos`` or ``mongod``) refreshes its query analyzer sample rates. The sample rate configured by the ``configureQueryAnalyzer`` command is divided among ``mongos`` instances in the sharded cluster or ``mongod`` instances in the replica set based on the traffic going through them. To make the sample rate assignment for a ``mongos`` or ``mongod`` more responsive to the traffic going through it, decrease this value. We recommend using the default value. .. include:: /includes/fact-startup-parameter Starting in MongoDB 7.0.1, you can set ``queryAnalysisSamplerConfigurationRefreshSecs`` during run time. This example sets ``queryAnalysisSamplerConfigurationRefreshSecs`` to 60 seconds at startup on a ``mongod`` instance: .. code-block:: bash mongod --setParameter queryAnalysisSamplerConfigurationRefreshSecs=60 This example sets ``queryAnalysisSamplerConfigurationRefreshSecs`` to 60 seconds at startup on a ``mongos`` instance: .. code-block:: bash mongos --setParameter queryAnalysisSamplerConfigurationRefreshSecs=60 To set the value to 30 seconds, run the following: .. code-block:: javascript db.adminCommand( { setParameter: 1, queryAnalysisSamplerConfigurationRefreshSecs: 30 } ) .. parameter:: queryAnalysisWriterIntervalSecs .. versionadded:: 7.0 .. versionchanged:: 7.0.1 |mongod-only| *Type*: integer *Default*: 90 Interval that sampled queries are written to disk, in seconds. .. include:: /includes/fact-startup-parameter Starting in MongoDB 7.0.1, you can set ``queryAnalysisWriterIntervalSecs`` during run time. This example sets ``queryAnalysisWriterIntervalSecs`` to 60 seconds at startup on a ``mongod`` instance: .. code-block:: bash mongod --setParameter queryAnalysisWriterIntervalSecs=60 To set the value to 60 seconds, run the following: .. code-block:: javascript db.adminCommand( { setParameter: 1, queryAnalysisWriterIntervalSecs: 60 } ) .. parameter:: queryAnalysisWriterMaxMemoryUsageBytes .. versionadded:: 7.0 |mongod-only| *Type*: integer *Default*: 100 * 1024 * 1024 Maximum amount of memory in bytes that the query sampling writer is allowed to use. Once the limit is reached, all new queries and diffs are discarded from sampling until the buffer is flushed. Must be greater than ``0``. .. include:: /includes/fact-runtime-startup-parameter This example sets ``queryAnalysisWriterMaxMemoryUsageBytes`` to ``10000000`` at startup on a ``mongod`` instance: .. code-block:: bash mongod --setParameter queryAnalysisWriterMaxMemoryUsageBytes=10000000 .. parameter:: queryAnalysisWriterMaxBatchSize .. versionadded:: 7.0 |mongod-only| *Type*: integer *Default*: 100000 Maximum number of sampled queries to write to disk at once. Must be greater than ``0`` and less than or equal to ``100000``. .. include:: /includes/fact-runtime-startup-parameter This example sets ``queryAnalysisWriterMaxBatchSize`` to ``1000`` at startup on a ``mongod`` instance: .. code-block:: bash mongod --setParameter queryAnalysisWriterMaxBatchSize=1000 During run time, you can also set the parameter with the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, queryAnalysisWriterMaxBatchSize: 1000 } ) .. parameter:: queryAnalysisSampleExpirationSecs .. versionadded:: 7.0 |mongod-only| *Type*: integer *Default*: 7 * 24 * 3600 Amount of time that a sampled query document exists before being removed by the TTL monitor, in seconds. Must be greater than ``0``. .. include:: /includes/fact-runtime-startup-parameter This example sets ``queryAnalysisSampleExpirationSecs`` to ``691200`` (``8 * 24 * 3600``) at startup on a ``mongod`` instance: .. code-block:: bash mongod --setParameter queryAnalysisSampleExpirationSecs=691200 During run time, you can also set the parameter with the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, queryAnalysisSampleExpirationSecs: 691200 } ) .. parameter:: readHedgingMode |mongos-only| *Type*: string *Default*: on Specifies whether :binary:`~bin.mongos` supports hedged reads for those read operations whose :doc:`read preference ` have enabled the hedged read option. Available values are: .. list-table:: :header-rows: 1 :widths: 35 85 * - Value - Description * - ``on`` - The :binary:`~bin.mongos` instance supports hedged reads for read operations whose :doc:`read preference ` have enabled the hedged read option. * - ``off`` - The :binary:`~bin.mongos` instance does not support hedged reads. That is, hedged reads are unavailable, even for read operations whose read preference have enabled the hedged read option. .. include:: /includes/fact-runtime-startup-parameter For example, to turn off hedged read support for a :binary:`~bin.mongos` instance, you can issue the following during startup: .. code-block:: bash mongos --setParameter readHedgingMode=off Or if using the :dbcommand:`setParameter` command in a :binary:`~bin.mongosh` session that is connected to a running :binary:`~bin.mongos`: .. code-block:: javascript db.adminCommand( { setParameter: 1, readHedgingMode: "off" } ) .. seealso:: - :ref:`mongos-hedged-reads` - :parameter:`maxTimeMSForHedgedReads` .. parameter:: routingTableCacheChunkBucketSize .. versionadded:: 7.0.1 .. versionchanged:: 7.2 |both| *Type*: integer *Default*: 500 Specifies the size of the routing table cache buckets used to implement chunk grouping optimization. Must be greater than ``0``. .. include:: /includes/fact-startup-parameter For example, to set the cache chunk bucket size to ``250`` on a ``mongod``, issue the following command at startup: .. code-block:: bash mongod --setParameter routingTableCacheChunkBucketSize=250 .. parameter:: shutdownTimeoutMillisForSignaledShutdown .. versionadded:: 5.0 |mongod-only| *Type*: integer *Default*: 15000 Specifies the time (in milliseconds) to wait for any ongoing database operations to complete before initiating a shutdown of :binary:`~bin.mongod` in response to a ``SIGTERM`` signal. .. include:: /includes/fact-runtime-startup-parameter For example, to set the time to 250 milliseconds, you can issue the following during startup: .. code-block:: bash mongod --setParameter shutdownTimeoutMillisForSignaledShutdown=250 Or if using the :dbcommand:`setParameter` command in a :binary:`~bin.mongosh` session that is connected to a running :binary:`~bin.mongod`: .. code-block:: javascript db.adminCommand( { setParameter: 1, shutdownTimeoutMillisForSignaledShutdown: 250 } ) .. parameter:: mongosShutdownTimeoutMillisForSignaledShutdown .. versionadded:: 5.0 |mongos-only| *Type*: integer *Default*: 15000 Specifies the time (in milliseconds) to wait for any ongoing database operations to complete before initiating a shutdown of :binary:`~bin.mongos` in response to a ``SIGTERM`` signal. .. include:: /includes/fact-runtime-startup-parameter For example, to set the time to 250 milliseconds, you can issue the following during startup: .. code-block:: bash mongos --setParameter mongosShutdownTimeoutMillisForSignaledShutdown=250 Or if using the :dbcommand:`setParameter` command in a :binary:`~bin.mongosh` session that is connected to a running :binary:`~bin.mongos`: .. code-block:: javascript db.adminCommand( { setParameter: 1, mongosShutdownTimeoutMillisForSignaledShutdown: 250 } ) .. parameter:: ShardingTaskExecutorPoolHostTimeoutMS |both| Type: integer Default: 300000 (5 minutes) Maximum time that :binary:`~bin.mongos` goes without communication to a host before :binary:`~bin.mongos` drops all connections to the host. If set, :parameter:`ShardingTaskExecutorPoolHostTimeoutMS` should be greater than the sum of :parameter:`ShardingTaskExecutorPoolRefreshRequirementMS` and :parameter:`ShardingTaskExecutorPoolRefreshTimeoutMS`. Otherwise, :binary:`~bin.mongos` adjusts the value of :parameter:`ShardingTaskExecutorPoolHostTimeoutMS` to be greater than the sum. .. include:: /includes/fact-runtime-startup-parameter The following example sets :parameter:`ShardingTaskExecutorPoolHostTimeoutMS` to ``120000`` during startup: .. code-block:: bash mongos --setParameter ShardingTaskExecutorPoolHostTimeoutMS=120000 During run time, you can also set the parameter with the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, ShardingTaskExecutorPoolHostTimeoutMS: 120000 } ) .. parameter:: ShardingTaskExecutorPoolMaxConnecting |both| Type: integer Default: 2 Maximum number of simultaneous initiating connections (including pending connections in setup/refresh state) each TaskExecutor connection pool can have to a :binary:`~bin.mongod` instance. You can set this parameter to control the rate at which :binary:`~bin.mongos` adds connections to a :binary:`~bin.mongod` instance. If set, :parameter:`ShardingTaskExecutorPoolMaxConnecting` should be less than or equal to :parameter:`ShardingTaskExecutorPoolMaxSize`. If it is greater, :binary:`~bin.mongos` ignores the :parameter:`ShardingTaskExecutorPoolMaxConnecting` value. .. include:: /includes/fact-runtime-startup-parameter The following example sets :parameter:`ShardingTaskExecutorPoolMaxConnecting` to ``20`` during startup: .. code-block:: bash mongos --setParameter ShardingTaskExecutorPoolMaxConnecting=20 During run time, you can also set the parameter with the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, ShardingTaskExecutorPoolMaxConnecting: 20 } ) .. parameter:: ShardingTaskExecutorPoolMaxSize |both| Type: integer Default: 2\ :sup:`64` - 1 Maximum number of outbound connections each TaskExecutor connection pool can open to any given :binary:`~bin.mongod` instance. The maximum possible connections to any given host across all TaskExecutor pools is: .. code-block:: none ShardingTaskExecutorPoolMaxSize * taskExecutorPoolSize .. include:: /includes/fact-runtime-startup-parameter The following example sets :parameter:`ShardingTaskExecutorPoolMaxSize` to ``20`` during startup: .. code-block:: bash mongos --setParameter ShardingTaskExecutorPoolMaxSize=20 During run time, you can also set the parameter with the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, ShardingTaskExecutorPoolMaxSize: 20 } ) :binary:`~bin.mongos` can have up to ``n`` TaskExecutor connection pools, where ``n`` is the number of cores. See :parameter:`taskExecutorPoolSize`. .. seealso:: :parameter:`ShardingTaskExecutorPoolMinSize` .. parameter:: ShardingTaskExecutorPoolMaxSizeForConfigServers .. versionadded:: 6.0 |both| Type: integer Default: -1 .. include:: /includes/ShardingTaskExecutorPoolMaxSizeForConfigServers-parameter.rst .. include:: /includes/ShardingTaskExecutorPoolMaxSizeForConfigServers-parameter-example.rst .. include:: /includes/fact-runtime-startup-parameter .. code-block:: bash mongos --setParameter ShardingTaskExecutorPoolMaxSizeForConfigServers=2 During run time, you can also set the parameter with the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, ShardingTaskExecutorPoolMaxSizeForConfigServers: 2 } ) .. _sharding-pool-minsize-parameters: .. parameter:: ShardingTaskExecutorPoolMinSize |both| Type: integer Default: 1 Minimum number of outbound connections each TaskExecutor connection pool can open to any given :binary:`~bin.mongod` instance. ``ShardingTaskExecutorPoolMinSize`` connections are created the first time a connection to a new host is requested from the pool. While the pool is idle, the pool maintains this number of connections until :parameter:`ShardingTaskExecutorPoolHostTimeoutMS` milliseconds pass without any application using that pool. For a :binary:`~bin.mongos` using the :parameter:`warmMinConnectionsInShardingTaskExecutorPoolOnStartup` parameter, the ``ShardingTaskExecutorPoolMinSize`` parameter also controls how many connections to each shard host are established on startup of the :binary:`~bin.mongos` instance before it begins accepting incoming client connections. .. include:: /includes/fact-runtime-startup-parameter The following example sets :parameter:`ShardingTaskExecutorPoolMinSize` to ``2`` during startup: .. code-block:: bash mongos --setParameter ShardingTaskExecutorPoolMinSize=2 During run time, you can also set the parameter with the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, ShardingTaskExecutorPoolMinSize: 2 } ) :binary:`~bin.mongos` can have up to ``n`` TaskExecutor connection pools, where ``n`` is the number of cores. See :parameter:`taskExecutorPoolSize`. .. seealso:: - :parameter:`ShardingTaskExecutorPoolMaxSize` - :parameter:`warmMinConnectionsInShardingTaskExecutorPoolOnStartup` .. parameter:: ShardingTaskExecutorPoolMinSizeForConfigServers .. versionadded:: 6.0 |both| Type: integer Default: -1 .. include:: /includes/ShardingTaskExecutorPoolMinSizeForConfigServers-parameter.rst .. include:: /includes/ShardingTaskExecutorPoolMinSizeForConfigServers-parameter-example.rst .. include:: /includes/fact-runtime-startup-parameter .. code-block:: bash mongos --setParameter ShardingTaskExecutorPoolMinSizeForConfigServers=2 During run time, you can also set the parameter with the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, ShardingTaskExecutorPoolMinSizeForConfigServers: 2 } ) .. parameter:: ShardingTaskExecutorPoolRefreshRequirementMS |both| Type: integer Default: 60000 (1 minute) Maximum time the :binary:`~bin.mongos` waits before attempting to heartbeat an idle connection in the pool. An idle connection may be discarded during the refresh if the pool is above its :ref:`minimum size `. If set, :parameter:`ShardingTaskExecutorPoolRefreshRequirementMS` should be greater than :parameter:`ShardingTaskExecutorPoolRefreshTimeoutMS`. Otherwise, :binary:`~bin.mongos` adjusts the value of :parameter:`ShardingTaskExecutorPoolRefreshTimeoutMS` to be less than :parameter:`ShardingTaskExecutorPoolRefreshRequirementMS`. .. include:: /includes/fact-runtime-startup-parameter The following example sets :parameter:`ShardingTaskExecutorPoolRefreshRequirementMS` to ``90000`` during startup: .. code-block:: bash mongos --setParameter ShardingTaskExecutorPoolRefreshRequirementMS=90000 During run time, you can also set the parameter with the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, ShardingTaskExecutorPoolRefreshRequirementMS: 90000 } ) .. parameter:: ShardingTaskExecutorPoolRefreshTimeoutMS |both| Type: integer Default: 20000 (20 seconds) Maximum time the :binary:`~bin.mongos` waits for a heartbeat before timing out the heartbeat. If set, :parameter:`ShardingTaskExecutorPoolRefreshTimeoutMS` should be less than :parameter:`ShardingTaskExecutorPoolRefreshRequirementMS`. Otherwise, :binary:`~bin.mongos` adjusts the value of :parameter:`ShardingTaskExecutorPoolRefreshTimeoutMS` to be less than :parameter:`ShardingTaskExecutorPoolRefreshRequirementMS`. .. include:: /includes/fact-runtime-startup-parameter The following example sets :parameter:`ShardingTaskExecutorPoolRefreshTimeoutMS` to ``30000`` during startup: .. code-block:: bash mongos --setParameter ShardingTaskExecutorPoolRefreshTimeoutMS=30000 During run time, you can also set the parameter with the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, ShardingTaskExecutorPoolRefreshTimeoutMS: 30000 } ) .. parameter:: ShardingTaskExecutorPoolReplicaSetMatching .. versionchanged:: 5.0 |both| Type: string Default: "automatic" On a :binary:`~bin.mongos` instance, this parameter sets the policy that determines the minimum size limit of its connection pools to nodes within replica sets. On a :binary:`~bin.mongod` instance, this parameter sets the policy that determines the minimum size limit of its connection pools to nodes within *other* replica sets. Note that this parameter only manages connections for operations that are directly related to user requests and CRUD operations. Available values are: .. list-table:: :header-rows: 1 :widths: 15 85 * - Matching Policy - Description * - ``"automatic"`` (Default) - Starting in 5.0, ``"automatic"`` is the new default value. When set for a :binary:`~bin.mongos`, the instance follows the behavior specified for the ``"matchPrimaryNode"`` option. When set for a :binary:`~bin.mongod`, the instance follows the behavior specified for the ``"disabled"`` option. :red:`WARNING:` If the :parameter:`ShardingTaskExecutorPoolReplicaSetMatching` is set to ``"automatic"``, the :data:`~connPoolStats.replicaSetMatchingStrategy` still describes the actual policy being used, not ``"automatic"``. To find the value of the :parameter:`ShardingTaskExecutorPoolReplicaSetMatching`, use :dbcommand:`getParameter` which returns the value of the server parameter. * - ``"matchPrimaryNode"`` - When set for a :binary:`~bin.mongos`, the minimum size limit of the instance's connection pool to each secondary of a replica set in the sharded cluster (specifically, shard replica set and config servers) is equal to the size of its connection pool to that replica set's primary. When set for a :binary:`~bin.mongod`, the minimum size limit of the instance's connection pool to each secondary of another replica set in the sharded cluster (specifically, shard replica set and config servers) is equal to the size of its connection pool to that replica set's primary. :red:`WARNING:` If multiple shard servers in your topology can experience a rapid influx of cross-shard operations, do not set this option on your :binary:`~bin.mongod` instances. In case of a primary stepdown, ``matchPrimaryNode`` ensures that any secondary that becomes the primary can handle the current level of primary reads and writes. * - ``"matchBusiestNode"`` - When set for a :binary:`~bin.mongos`, the instance's minimum size limit of the connection pool to each member of a replica set in the sharded cluster (specifically, shard replica set and config servers) is equal to the largest among the active connection counts to the primary and each secondary member of that replica set. When set for a :binary:`~bin.mongod`, the instance's minimum size limit of the connection pool to each member of another replica set in the sharded cluster (specifically, shard replica set and config servers) is equal to the largest among the active connection counts to the primary and each secondary member of that replica set. With ``"matchBusiestNode"``, :binary:`~bin.mongos` maintains enough connections to each secondary to handle the current level of primary and secondary reads and writes. The number of connections to maintain in the pool decreases as the number of active connections decreases. * - ``"disabled"`` - When set for a :binary:`~bin.mongos`, the instance's minimum number of connections in the instance's connection pool to each node of a replica set in the sharded clusterv (specifically, shard replica set and config servers) is equal to the :parameter:`ShardingTaskExecutorPoolMinSize`. When set for a :binary:`~bin.mongod`, the instance's minimum number of connections in the instance's connection pool to each node of another replica set in the sharded cluster (specifically, shard replica set and config servers) is equal to the :parameter:`ShardingTaskExecutorPoolMinSize`. .. include:: /includes/fact-runtime-startup-parameter The following example sets the :parameter:`ShardingTaskExecutorPoolReplicaSetMatching` to ``"automatic"`` during startup: .. code-block:: bash mongod --setParameter ShardingTaskExecutorPoolReplicaSetMatching="automatic" During run time, you can also set the parameter with the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, ShardingTaskExecutorPoolReplicaSetMatching: "automatic" } ) .. parameter:: taskExecutorPoolSize |mongos-only| Type: integer Default: 1 The number of Task Executor connection pools to use for a given :binary:`~bin.mongos`. If the parameter value is ``0`` or less, the number of Task Executor connection pools is the number of cores with the following exceptions: - If the number of cores is less than 4, the number of Task Executor connection pools is 4. - If the number of cores is greater than 64, the number of Task Executor connection pools is 64. .. include:: /includes/fact-taskExecutorPoolSize-on-Linux.rst The default value of :parameter:`taskExecutorPoolSize` is ``1``: .. include:: /includes/fact-runtime-startup-parameter .. code-block:: bash mongos --setParameter taskExecutorPoolSize=6 .. seealso:: - :parameter:`ShardingTaskExecutorPoolMaxSize` - :parameter:`ShardingTaskExecutorPoolMinSize` .. parameter:: loadRoutingTableOnStartup |mongos-only| Type: boolean *Default*: true Configures a :binary:`~bin.mongos` instance to preload the routing table for a sharded cluster on startup. With this setting enabled, the :binary:`~bin.mongos` caches the cluster-wide routing table for each sharded collection as part of its startup procedure, before it begins accepting client connections. Without this setting enabled, the :binary:`~bin.mongos` only loads a routing table as needed for incoming client connections, and only loads the specific routing table for the namespace of a given request. A :binary:`~bin.mongos` instance with the :parameter:`loadRoutingTableOnStartup` parameter enabled may experience longer startup times, but will result in faster servicing of initial client connections once started. :parameter:`loadRoutingTableOnStartup` is enabled by default. .. include:: /includes/fact-startup-parameter .. parameter:: warmMinConnectionsInShardingTaskExecutorPoolOnStartup |mongos-only| Type: boolean *Default*: true Configures a :binary:`~bin.mongos` instance to prewarm its connection pool on startup. With this parameter enabled, the :binary:`~bin.mongos` attempts to establish :parameter:`ShardingTaskExecutorPoolMinSize` network connections to each shard server as part of its startup procedure, before it begins accepting client connections. A timeout for this behavior can be configured with the :parameter:`warmMinConnectionsInShardingTaskExecutorPoolOnStartupWaitMS` parameter. If this timeout is reached, the :binary:`~bin.mongos` will begin accepting client connections regardless of the size of its connection pool. A :binary:`~bin.mongos` instance with this parameter enabled may experience longer startup times, but will result in faster servicing of initial client connections once started. :parameter:`warmMinConnectionsInShardingTaskExecutorPoolOnStartup` is enabled by default. .. include:: /includes/fact-startup-parameter .. seealso:: - :parameter:`warmMinConnectionsInShardingTaskExecutorPoolOnStartupWaitMS` - :parameter:`ShardingTaskExecutorPoolMinSize` .. parameter:: warmMinConnectionsInShardingTaskExecutorPoolOnStartupWaitMS |mongos-only| Type: integer *Default*: 2000 (2 seconds) Sets the timeout threshold in milliseconds for a :binary:`~bin.mongos` to wait for :parameter:`ShardingTaskExecutorPoolMinSize` connections to be established per shard host when using the :parameter:`warmMinConnectionsInShardingTaskExecutorPoolOnStartup` parameter. If this timeout is reached, the :binary:`~bin.mongos` will begin accepting client connections regardless of the size of its connection pool. .. include:: /includes/fact-startup-parameter .. seealso:: - :parameter:`warmMinConnectionsInShardingTaskExecutorPoolOnStartup` - :parameter:`ShardingTaskExecutorPoolMinSize` .. parameter:: migrateCloneInsertionBatchDelayMS |mongod-only| Type: Non-negative integer Default: 0 Time in milliseconds to wait between batches of insertions during cloning step of the migration process. This wait is in addition to the ``secondaryThrottle``. The default value of ``0`` indicates no additional wait. .. include:: /includes/fact-runtime-startup-parameter The following sets the :parameter:`migrateCloneInsertionBatchDelayMS` to 200 milliseconds: .. code-block:: bash mongod --setParameter migrateCloneInsertionBatchDelayMS=200 The parameter may also be set using the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, migrateCloneInsertionBatchDelayMS: 200 } ) .. parameter:: migrateCloneInsertionBatchSize |mongod-only| Type: Non-negative integer Default: 0 The maximum number of documents to insert in a single batch during the cloning step of the migration process. The default value of ``0`` indicates no maximum number of documents per batch. However, in practice, this results in batches that contain up to 16 MB of documents. .. include:: /includes/fact-runtime-startup-parameter The following sets the :parameter:`migrateCloneInsertionBatchSize` to 100 documents: .. code-block:: bash mongod --setParameter migrateCloneInsertionBatchSize=100 The parameter may also be set using the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, migrateCloneInsertionBatchSize: 100 } ) .. parameter:: orphanCleanupDelaySecs |mongod-only| Default: 900 (15 minutes) Minimum delay before a migrated :term:`chunk` is deleted from the source shard. Before deleting the chunk during chunk migration, MongoDB waits for :parameter:`orphanCleanupDelaySecs` or for in-progress queries involving the chunk to complete on the shard primary, whichever is longer. However, because the shard primary has no knowledge of in-progress queries run on the shard secondaries, queries that use the chunk but are run on secondaries may see documents disappear if these queries take longer than the time to complete the shard primary queries and the :parameter:`orphanCleanupDelaySecs`. .. note:: This behavior only affects in-progress queries that start before the chunk migration. Queries that start after the chunk migration starts will not use the migrating chunk. If a shard has storage constraints, consider reducing this value temporarily. If running queries that exceed 15 minutes on shard secondaries, consider increasing this value. .. include:: /includes/fact-runtime-startup-parameter The following sets the :parameter:`orphanCleanupDelaySecs` to 20 minutes: .. code-block:: bash mongod --setParameter orphanCleanupDelaySecs=1200 This may also be set using the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, orphanCleanupDelaySecs: 1200 } ) .. tip:: In all versions, the new value of :parameter:`orphanCleanupDelaySecs` is only applied to range deletions created after the value is changed. To apply the new value to existing range deletions, :ref:`force a step down `. .. parameter:: persistedChunkCacheUpdateMaxBatchSize .. versionadded:: 7.2 (and 7.1.1, 7.0.4, 6.0.13, 5.0.25) |mongod-only| Type: Integer Default: 1000 To route and serve operations, shards must know the routing and ownership information associated with their collections. This information propogates from a shard's primary node to its secondary nodes through the replication of the internal cache collections ``config.cache.collections`` and ``config.cache.chunks.``. In previous versions, updates on the chunk cache collection were performed individually (meaning that an entry was deleted and a new entry was inserted). Starting in MongoDB 7.2, these updates are performed as a batch of deletions followed by a batch of insertions. The updated logic improves performance for collections that contain a large number of chunks. The ``persistedChunkCacheUpdateMaxBatchSize`` parameter specifies the maximum batch size used for updating the persisted chunk cache. .. include:: /includes/fact-runtime-startup-parameter The following example sets ``persistedChunkCacheUpdateMaxBatchSize`` to 700 at startup: .. code-block:: bash mongod --setParameter persistedChunkCacheUpdateMaxBatchSize=700 You can also set ``persistedChunkCacheUpdateMaxBatchSize`` during runtime: .. code-block:: javascript db.adminCommand( { setParameter: 1, persistedChunkCacheUpdateMaxBatchSize: 700 } ) .. parameter:: rangeDeleterBatchDelayMS |mongod-only| Type: Non-negative integer Default: 20 The amount of time in milliseconds to wait before the next batch of deletion during the cleanup stage of :ref:`range migration `. The :ref:`_secondaryThrottle replication delay ` occurs after each batch deletion. .. include:: /includes/fact-runtime-startup-parameter The following sets the :parameter:`rangeDeleterBatchDelayMS` to 200 milliseconds: .. code-block:: bash mongod --setParameter rangeDeleterBatchDelayMS=200 The parameter may also be set using the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, rangeDeleterBatchDelayMS: 200 } ) .. tip:: In versions prior to 6.0.3, the new value of :parameter:`rangeDeleterBatchDelayMS` is only applied to range deletions created after the value is changed. To apply the new value to existing range deletions, :ref:`force a step down `. From 6.0.3 on, the new value of the parameter is applied to all the range deletions processed after the update, regardless of when the range deletion was created. .. parameter:: rangeDeleterBatchSize |mongod-only| Type: Non-negative integer Default: 2147483647 starting in MongoDB 5.1.2 and 5.0.6 The maximum number of documents in each batch to delete during the cleanup stage of :ref:`range migration `. A value of ``0`` indicates that the system chooses the default value. .. include:: /includes/fact-runtime-startup-parameter The following example sets :parameter:`rangeDeleterBatchSize` to 32 documents: .. code-block:: bash mongod --setParameter rangeDeleterBatchSize=32 The parameter may also be set using the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, rangeDeleterBatchSize: 32 } ) .. tip:: In versions prior to 6.0.3, the new value of :parameter:`rangeDeleterBatchSize` is only applied to range deletions created after the value is changed. To apply the new value to existing range deletions, :ref:`force a step down `. From 6.0.3 on, the new value of the parameter is applied to all the range deletions processed after the update, regardless of when the range deletion was created. .. parameter: rangeDeleterHighPriority .. versionadded:: 7.0 |mongod-only| Type: boolean Default: false When ``true``, prioritizes cleanup of :term:`orphaned documents ` over user operations. By default, this is set to ``false`` to prioritize user operations over cleanup of orphaned documents. .. include:: /includes/fact-runtime-startup-parameter The following example sets :parameter:`rangeDeleterHighPriority` to ``true``: .. code-block:: bash mongod --setParameter rangeDeleterHighPriority=true The parameter may also be set using the :dbcommand:`setParameter` command: .. code-block:: javascript db.adminCommand( { setParameter: 1, rangeDeleterBatchSize: true } ) .. Commenting out rangeDeleterHighPriority content in DOCSP-45407. .. TODO, uncomment the content for the rangeDeleterHighPriority parameter in .. DOCSP-45584, only once the work in SERVER-79291 to re-enable this feature .. flag is completed. Thanks! .. parameter:: skipShardingConfigurationChecks |mongod-only| Type: boolean Default: false When ``true``, allows for starting a shard member or config server member as a standalone for maintenance operations. This parameter is mutually exclusive with the :option:`--configsvr ` or :option:`--shardsvr ` options. .. include:: /includes/fact-startup-parameter .. code-block:: bash mongod --setParameter skipShardingConfigurationChecks=true .. important:: Once maintenance has completed, remove the :parameter:`skipShardingConfigurationChecks` parameter when restarting the :binary:`~bin.mongod`. .. parameter:: findChunksOnConfigTimeoutMS .. versionadded:: 5.0 |both| Type: Non-negative integer Default: 900000 The timeout in milliseconds for find operations on :data:`~config.chunks`. If there is a large number of chunks in the cluster and chunk loading fails with the error ``ExceededTimeLimit``, increase the parameter value: .. code-block:: bash mongod --setParameter findChunksOnConfigTimeoutMS=1000000 .. include:: /includes/fact-runtime-startup-parameter .. include:: /includes/health-manager-short-names.rst .. _health-manager-parameters: Health Manager Parameters ~~~~~~~~~~~~~~~~~~~~~~~~~ .. parameter:: activeFaultDurationSecs |mongos-only| *Type*: Document The amount of time to wait from a |HMREF| failure until the :ref:`mongos ` is removed from the cluster, in seconds. When a failure is detected and a |HM| is configured as ``critical``, the server waits for the specified interval before removing the ``mongos`` from the cluster. .. include:: /includes/fact-runtime-startup-parameter .. include:: /includes/example-activeFaultDurationSecs.rst .. parameter:: healthMonitoringIntensities |mongos-only| *Type*: Array of documents Use this parameter to set intensity levels for |HMS|. .. include:: /includes/fact-runtime-startup-parameter .. include:: /includes/fact-healthMonitoringIntensities-values-array.rst Health Managers ``````````````` .. include:: /includes/fact-health-manager-facets.rst Intensity Levels ```````````````` .. include:: /includes/fact-health-manager-intensities.rst .. include:: /includes/example-healthMonitoringIntensities.rst .. parameter:: healthMonitoringIntervals |mongos-only| *Type*: Array of documents How often this |HM| will run, in milliseconds. .. include:: /includes/fact-runtime-startup-parameter .. include:: /includes/fact-healthMonitoringIntervals-values-array.rst Health Managers ``````````````` .. include:: /includes/fact-health-manager-facets.rst .. include:: /includes/example-healthMonitoringIntervals.rst .. parameter:: progressMonitor |mongos-only| *Type*: Document .. include:: /includes/fact-progressMonitor.rst .. include:: /includes/fact-runtime-startup-parameter ``progressMonitor`` Fields `````````````````````````` .. include:: /includes/fact-progress-monitor-fields.rst .. include:: /includes/example-progress-monitor.rst Storage Parameters ~~~~~~~~~~~~~~~~~~ .. parameter:: honorSystemUmask |mongod-only| *Default*: ``false`` If :parameter:`honorSystemUmask` is set to ``true``, new files created by MongoDB have permissions in accordance with the user's ``umask`` settings. You cannot set :parameter:`processUmask` if :parameter:`honorSystemUmask` is set to ``true``. If :parameter:`honorSystemUmask` is set to ``false``, new files created by MongoDB have permissions set to ``600``, which gives read and write permissions only to the owner. New directories have permissions set to ``700``. You can use :parameter:`processUmask` to override the default permissions for groups and other users on all new files created by MongoDB. .. include:: /includes/fact-startup-parameter .. code-block:: bash mongod --setParameter honorSystemUmask=true .. note:: :parameter:`honorSystemUmask` is not available on Windows systems. .. parameter:: journalCommitInterval |mongod-only| Specify an integer between ``1`` and ``500`` signifying the number of milliseconds (ms) between journal commits. .. include:: /includes/fact-runtime-startup-parameter Consider the following example which sets the :parameter:`journalCommitInterval` to ``200`` ms: .. code-block:: javascript db.adminCommand( { setParameter: 1, journalCommitInterval: 200 } ) .. seealso:: :setting:`storage.journal.commitIntervalMs` .. parameter:: minSnapshotHistoryWindowInSeconds .. versionadded:: 5.0 |mongod-only| *Default*: ``300`` The minimum time window in seconds for which the storage engine keeps the snapshot history. If you query data using read concern :readconcern:`"snapshot"` and specify an :ref:`atClusterTime ` value older than the specified ``minSnapshotHistoryWindowInSeconds``, :binary:`~bin.mongod` returns a ``SnapshotTooOld`` error. .. warning:: In sharded clusters, changing the default ``minSnapshotHistoryWindowInSeconds`` value on :ref:`config server ` nodes may cause internal operations to fail. Do not set ``minSnapshotHistoryWindowInSeconds`` to ``0`` on config server nodes. Setting this parameter to ``0`` causes internal operations conducting ``snapshot`` reads targeting the config server with a specified ``atClusterTime`` to fail. .. include:: /includes/fact-runtime-startup-parameter Specify an integer greater than or equal to (``>=``) 0. Consider the following example which sets the ``minSnapshotHistoryWindowInSeconds`` to ``600`` seconds: .. code-block:: javascript db.adminCommand( { setParameter: 1, minSnapshotHistoryWindowInSeconds: 600 } ) .. note:: Increasing the value of :parameter:`minSnapshotHistoryWindowInSeconds` increases disk usage. For more information, see :ref:`storage-snapshot-history`. To modify this value for a :atlas:`MongoDB Atlas ` cluster, you must contact :atlas:`Atlas Support `. .. parameter:: processUmask |mongod-only| Overrides the default permissions used for groups and other users when :parameter:`honorSystemUmask` is set to ``false``. By default, when :parameter:`honorSystemUmask` is set to ``false``, new files created by MongoDB have permissions set to ``600``. Use the ``processUmask`` parameter to override this default with a custom ``umask`` value. The file owner inherits permissions from the system ``umask``. .. include:: /includes/fact-startup-parameter You cannot set this parameter if :parameter:`honorSystemUmask` is set to ``true``. Consider the following example, which sets the permissions for groups and other users to read/write only and retains the system ``umask`` settings for the owner: .. code-block:: bash mongod --setParameter processUmask=011 .. note:: :parameter:`processUmask` is not available on Windows systems. .. parameter:: storageEngineConcurrentReadTransactions .. versionchanged:: 7.0 |mongod-only| *Type*: integer Specifies the maximum number of concurrent read transactions (read tickets) allowed into the storage engine. .. include:: /includes/fact-concurrent-read-write-dynamic-behavior Starting in MongoDB 7.0, this parameter is available for all storage engines. In earlier versions, this parameter is available for the WiredTiger storage engine only. .. seealso:: :serverstatus:`queues.execution` .. parameter:: storageEngineConcurrentWriteTransactions .. versionchanged:: 7.0 |mongod-only| *Type*: integer Specifies the maximum number of concurrent write transactions allowed into the WiredTiger storage engine. .. include:: /includes/fact-concurrent-read-write-dynamic-behavior Starting in MongoDB 7.0, this parameter is available for all storage engines. In earlier versions, this parameter is available for the WiredTiger storage engine only. .. seealso:: :serverstatus:`queues.execution` .. parameter:: syncdelay |mongod-only| *Default*: 60 Specify the interval in seconds when :binary:`~bin.mongod` flushes its working memory to disk. By default, :binary:`~bin.mongod` flushes memory to disk every 60 seconds. In almost every situation you should not set this value and use the default setting. .. include:: /includes/fact-runtime-startup-parameter Consider the following example which sets the ``syncdelay`` to ``60`` seconds: .. code-block:: javascript db.adminCommand( { setParameter: 1, syncdelay: 60 } ) .. include:: /includes/checkpoints.rst .. seealso:: - :parameter:`journalCommitInterval` - :setting:`storage.syncPeriodSecs` .. parameter:: temporarilyUnavailableBackoffBaseMs |mongod-only| *Default*: 1000 Specifies the initial delay before retying a write operation that was rolled back due to cache pressure. .. include:: /includes/reference/fact-parameters-cache-pressure.rst The parameter accepts: .. list-table:: :header-rows: 1 :widths: 20 80 * - Value - Description * - ``integer >= 0`` - Defaults to 1 second. The initial delay between retries. The value increases with each retry to a maximum of 55 seconds. A larger value increases the chance that the cache pressure will be reduced before the next retry. To configure number of retries, use :parameter:`temporarilyUnavailableMaxRetries`. .. include:: /includes/fact-runtime-startup-parameter To set a new value, use :method:`db.adminCommand()`: .. code-block:: javascript db.adminCommand( { setParameter: 1, temporarilyUnavailableBackoffBaseMs: 3 } ) .. versionadded:: 6.1.0 .. parameter:: temporarilyUnavailableMaxRetries |mongod-only| *Default*: 10 Specifies the maximum number of retries when a write operation is rolled back due to cache pressure. .. include:: /includes/reference/fact-parameters-cache-pressure.rst The parameter accepts: .. list-table:: :header-rows: 1 :widths: 20 80 * - Value - Description * - ``integer >= 0`` - The maximum number of retries. There is an increasing delay between retries. To configure the backoff time, use :parameter:`temporarilyUnavailableBackoffBaseMs`. .. include:: /includes/fact-runtime-startup-parameter To set a new value, use :method:`db.adminCommand()`: .. code-block:: javascript db.adminCommand( { setParameter: 1, temporarilyUnavailableMaxRetries: 5 } ) .. versionadded:: 6.1.0 WiredTiger Parameters ~~~~~~~~~~~~~~~~~~~~~ .. parameter:: wiredTigerConcurrentReadTransactions |mongod-only| *Type*: integer Specifies the maximum number of concurrent read transactions (read tickets) allowed into the storage engine. .. include:: /includes/fact-concurrent-read-write-dynamic-behavior Starting in MongoDB 7.0, this parameter is available for all storage engines. In earlier versions, this parameter is available for the WiredTiger storage engine only. .. versionchanged:: 6.0 The ``wiredTigerConcurrentReadTransactions`` parameter was renamed to :parameter:`storageEngineConcurrentReadTransactions`. .. parameter:: wiredTigerConcurrentWriteTransactions |mongod-only| *Type*: integer Specifies the maximum number of concurrent write transactions allowed into the WiredTiger storage engine. .. include:: /includes/fact-concurrent-read-write-dynamic-behavior Starting in MongoDB 7.0, this parameter is available for all storage engines. In earlier versions, this parameter is available for the WiredTiger storage engine only. .. versionchanged:: 6.0 The ``wiredTigerConcurrentWriteTransactions`` parameter was renamed to :parameter:`storageEngineConcurrentWriteTransactions`. .. parameter:: wiredTigerEngineRuntimeConfig |mongod-only| Specify ``wiredTiger`` storage engine configuration options for a running :binary:`~bin.mongod` instance. .. include:: /includes/fact-runtime-parameter .. warning:: Avoid modifying the :parameter:`wiredTigerEngineRuntimeConfig` unless under the direction from MongoDB engineers as this setting has major implication across both WiredTiger and MongoDB. Consider the following operation prototype: .. code-block:: javascript db.adminCommand({ "setParameter": 1, "wiredTigerEngineRuntimeConfig": "