On this page本页内容
MongoDB provides a number of configuration options that you can set using:MongoDB提供了许多配置选项,您可以使用:
the setParameter
command:setParameter
命令:
db.adminCommand( { setParameter: 1, <parameter>: <value> } )
the setParameter
configuration setting:setParameter
配置设置:
setParameter: <parameter1>: <value1> ...
the --setParameter
command-line option for mongod
and mongos
:mongod
和mongos
的--setParameter
命令行选项:
mongod --setParameter <parameter>=<value> mongos --setParameter <parameter>=<value>
For additional configuration options, see Configuration File Options, 有关其他配置选项,请参阅配置文件选项mongod
and mongos
.mongod
和mongos
。
authenticationMechanisms
Changed in version 4.0.在版本4.0中更改。
MONGODB-CR
authentication mechanism.MONGODB-CR
身份验证机制的支持。
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
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 Authentication.有关身份验证机制的描述,请参阅身份验证。
SCRAM-SHA-1 | RFC 5802 |
SCRAM-SHA-256 | RFC 7677
|
MONGODB-X509 | MongoDB TLS/SSL |
GSSAPI (Kerberos) | |
PLAIN (LDAP SASL) | PLAIN for authenticating in-database users. PLAIN transmits passwords in plain text. PLAIN 传输明文密码。 |
You can only set 只能在启动期间设置authenticationMechanisms
during start-up.authenticationMechanisms
(身份验证机制)。
For example, to specify both 例如,要将PLAIN
and SCRAM-SHA-256
as the authentication mechanisms, use the following command:PLAIN
和SCRAM-SHA-256
指定为身份验证机制,请使用以下命令:
mongod --setParameter authenticationMechanisms=PLAIN,SCRAM-SHA-256 --auth
clusterAuthMode
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Set the 将clusterAuthMode
to either sendX509
or x509
. clusterAuthMode
设置为sendX509
或x509
。Useful during rolling upgrade to use x509 for membership authentication to minimize downtime.在滚动升级期间使用x509进行成员身份验证以最小化停机时间非常有用。
For more information about TLS/SSL and MongoDB, see Configure 有关TLS/SSL和MongoDB的更多信息,请参阅为TLS/SSL配置mongod
and mongos
for TLS/SSL and TLS/SSL Configuration for Clients .mongod
和mongos
以及用于客户端TLS/SSL配置。
db.adminCommand( { setParameter: 1, clusterAuthMode: "sendX509" } )
enableLocalhostAuthBypass
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Specify 指定0
or false
to disable localhost authentication bypass. 0
或false
以禁用本地主机身份验证旁路。Enabled by default.默认情况下启用。
使用enableLocalhostAuthBypass
is not available using setParameter
database command. setParameter
数据库命令时,enableLocalhostAuthBypass
不可用。Use the 使用配置文件中的setParameter
option in the configuration file or the --setParameter
option on the command line.setParameter
选项或命令行中的--setParameter
选项。
See Localhost Exception for more information.有关详细信息,请参阅本地主机异常。
KeysRotationIntervalSec
Default默认值: 7776000 seconds (90 days)
Specifies the number of seconds for which an HMAC signing key is valid before rotating to the next one. 指定在旋转到下一个HMAC签名密钥之前HMAC签名密钥有效的秒数。This parameter is intended primarily to facilitate authentication testing.此参数主要用于促进身份验证测试。
You can only set 只能在启动期间设置KeysRotationIntervalSec
during start-up, and cannot change this setting with the setParameter
database command.KeysRotationIntervalSec
,不能使用setParameter
数据库命令更改此设置。
ldapUserCacheInvalidationInterval
Changed in version 5.2.在版本5.2中更改。
Starting in MongoDB 5.2, the update interval for cached user information retrieved from an LDAP server depends on 从MongoDB 5.2开始,从LDAP服务器检索的缓存用户信息的更新间隔取决于ldapShouldRefreshUserCacheEntries
:ldapShouldRefreshUserCacheEntries
:
ldapUserCacheRefreshInterval
.true
,使用ldapUserCacheRefreshInterval
。ldapUserCacheInvalidationInterval
.false
,使用ldapUserCacheInvalidationInterval
。For use with MongoDB deployments using LDAP Authorization. 用于使用LDAP授权的MongoDB部署。Available for 仅适用于mongod
instances only.mongod
实例。
The interval (in seconds) that the mongod
instance waits between external user cache flushes. mongod
实例在外部用户缓存刷新之间等待的时间间隔(秒)。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.MongoDB刷新外部用户缓存后,下次LDAP授权用户发出操作时,MongoDB将从LDAP服务器重新获取授权数据。
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. 增加指定的值会增加MongoDB和LDAP服务器可能不同步的时间,但会减少LDAP服务器上的负载。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.相反,减少指定的值会减少MongoDB和LDAP服务器不同步的时间,同时增加LDAP服务器上的负载。
Defaults to 30 seconds.默认为30秒。
ldapUserCacheRefreshInterval
New in version 5.2.在版本5.2中新增。
Available for 仅适用于mongod
only.mongod
。
Type类型: integer
Default默认值: 30 seconds
Starting in MongoDB 5.2, the update interval for cached user information retrieved from an LDAP server depends on 从MongoDB 5.2开始,从LDAP服务器检索的缓存用户信息的更新间隔取决于ldapShouldRefreshUserCacheEntries
:ldapShouldRefreshUserCacheEntries
:
ldapUserCacheRefreshInterval
.true
,则使用ldapUserCacheRefreshInterval
。ldapUserCacheInvalidationInterval
.false
,则使用ldapUserCacheInvalidationInterval
。For MongoDB deployments using LDAP Authorization.用于使用LDAP授权的MongoDB部署。
The interval in seconds that mongod
waits before refreshing the cached user information from the LDAP server.mongod
从LDAP服务器刷新缓存的用户信息之前等待的时间间隔(秒)。
The maximum interval is 86,400 seconds (24 hours).最大间隔为86400秒(24小时)。
For example, the following sets 例如,以下命令将ldapUserCacheRefreshInterval
to 4000
seconds:ldapUserCacheRefreshInterval
设置为4000秒:
mongod --setParameter ldapUserCacheRefreshInterval=4000
Or, if using the 或者,如果在setParameter
command within mongosh
:mongosh
中使用setParameter
命令:
db.adminCommand( { setParameter: 1, ldapUserCacheRefreshInterval: 4000 } )
ldapUserCacheStalenessInterval
New in version 5.2.在版本5.2中新增。
Available for 仅适用于mongod
only.mongod
。
Type类型: integer
Default默认值: 90 seconds
For MongoDB deployments using LDAP Authorization.用于使用LDAP授权的MongoDB部署。
The interval in seconds that mongod
retains the cached LDAP user information after the last cache refresh.mongod
在上次缓存刷新后保留缓存的LDAP用户信息的时间间隔(秒)。
If more than 如果在LDAP服务器上没有成功刷新用户信息的情况下,超过ldapUserCacheStalenessInterval
seconds elapse without a successful refresh of the user information from the LDAP server, then mongod
:ldapUserCacheStalenessInterval
秒,则mongod
:
mongod
contacts the LDAP server.mongod
联系LDAP服务器之前,LDAP用户无法进行身份验证。The maximum interval is 86,400 seconds (24 hours).最大间隔为86400秒(24小时)。
For example, the following sets 例如,以下命令将ldapUserCacheStalenessInterval
to 4000
seconds:ldapUserCacheStalenessInterval
设置为4000
秒:
mongod --setParameter ldapUserCacheStalenessInterval=4000
Or, if using the 或者,如果在setParameter
command within mongosh
:mongosh
中使用setParameter
命令:
db.adminCommand( { setParameter: 1, ldapUserCacheStalenessInterval: 4000 } )
ldapUseConnectionPool
New in version 4.0.9.在版本4.0.9中新增。
Specifies whether MongoDB should use connection pooling when connecting to the LDAP server for authentication/authorization.指定MongoDB在连接LDAP服务器进行身份验证/授权时是否应使用连接池。
Starting in version 4.2, MongoDB uses the following default values:从4.2版开始,MongoDB使用以下默认值:
true
。libldap_r
.true
,其中MongoDB企业二进制文件与libldap_r
链接。libldap
.false
,其中MongoDB企业二进制文件链接到libldap
。In earlier versions (versions 4.0.9+), the default value is false
.
You can only set 只能在启动期间设置ldapUseConnectionPool
during start-up, and cannot change this setting with the setParameter
database command.ldapUseConnectionPool
,不能使用setParameter
数据库命令更改此设置。
ldapConnectionPoolUseLatencyForHostPriority
New in version 4.2.1 and 4.0.13版本4.2.1和4.0.13中新增
Default默认值: true
A boolean that determines whether the LDAP connection pool (see 一个布尔值,用于确定LDAP连接池(请参阅ldapUseConnectionPool
) should use latency of the LDAP servers to determine the connection order (from lowest latency to highest).ldapUseConnectionPool
)是否应使用LDAP服务器的延迟来确定连接顺序(从最低延迟到最高延迟)。
You can only set 只能在启动期间设置ldapConnectionPoolUseLatencyForHostPriority
during start-up, and cannot change this setting during runtime with the setParameter
database command.ldapConnectionPoolUseLatencyForHostPriority
,不能使用setParameter
数据库命令在运行期间更改此设置。
ldapConnectionPoolMinimumConnectionsPerHost
New in version 4.2.1 and 4.0.13版本4.2.1和4.0.13中新增
Default默认值: 1
The minimum number of connections to keep open to each LDAP server.每个LDAP服务器保持打开状态的最小连接数。
You can only set 只能在启动期间设置ldapConnectionPoolMinimumConnectionsPerHost
during start-up, and cannot change this setting during runtime with the setParameter
database command.ldapConnectionPoolMinimumConnectionsPerHost
,不能使用setParameter
数据库命令在运行期间更改此设置。
ldapConnectionPoolMaximumConnectionsPerHost
New in version 4.2.1 and 4.0.13版本4.2.1和4.0.13中新增
Changed in version 4.4.在版本4.4中更改。
2
. 2
。Default默认值: 2
The maximum number of connections to keep open to each LDAP server.每个LDAP服务器保持打开状态的最大连接数。
You can only set 只能在启动期间设置ldapConnectionPoolMaximumConnectionsPerHost
during start-up, and cannot change this setting during runtime with the setParameter
database command.ldapConnectionPoolMaximumConnectionsPerHost
,不能使用setParameter
数据库命令在运行期间更改此设置。
ldapConnectionPoolMaximumConnectionsInProgressPerHost
New in version 4.2.1 and 4.0.13版本4.2.1和4.0.13中新增
The maximum number of in-progress connect operations to each LDAP server.到每个LDAP服务器的最大进行中连接操作数。
You can only set 只能在启动期间设置ldapConnectionPoolMaximumConnectionsInProgressPerHost
during start-up, and cannot change this setting with the setParameter
database command.ldapConnectionPoolMaximumConnectionsInProgressPerHost
,不能使用setParameter
数据库命令更改此设置。
ldapConnectionPoolHostRefreshIntervalMillis
New in version 4.2.1 and 4.0.13版本4.2.1和4.0.13中新增
Default默认值: 60000
The number of milliseconds in-between health checks of the pooled LDAP connections.池LDAP连接的运行状况检查之间的毫秒数。
You can only set 只能在启动期间设置ldapConnectionPoolHostRefreshIntervalMillis
during start-up, and cannot change this setting with the setParameter
database command.ldapConnectionPoolHostRefreshIntervalMillis
,不能使用setParameter
数据库命令更改此设置。
ldapConnectionPoolIdleHostTimeoutSecs
New in version 4.2.1 and 4.0.13版本4.2.1和4.0.13中新增
Default默认值: 300
The maximum number of seconds that the pooled connections to an LDAP server can remain idle before being closed.到LDAP服务器的池连接在关闭前可以保持空闲的最大秒数。
You can only set 只能在启动期间设置ldapConnectionPoolIdleHostTimeoutSecs
during start-up, and cannot change this setting with the setParameter
database command.ldapConnectionPoolIdleHostTimeoutSecs
,不能使用setParameter
数据库命令更改此设置。
ldapShouldRefreshUserCacheEntries
New in version 5.2.在版本5.2中新增。
Available for 仅适用于mongod
only.mongod
。
Type类型: boolean
Default默认值: true
For MongoDB deployments using LDAP Authorization.用于使用LDAP授权的MongoDB部署。
Starting in MongoDB 5.2, the update interval for cached user information retrieved from an LDAP server depends on 从MongoDB 5.2开始,从LDAP服务器检索的缓存用户信息的更新间隔取决于ldapShouldRefreshUserCacheEntries
:ldapShouldRefreshUserCacheEntries
:
ldapUserCacheRefreshInterval
.true
,使用ldapUserCacheRefreshInterval
。ldapUserCacheInvalidationInterval
.false
,使用ldapUserCacheInvalidationInterval
。You can only set 在启动期间,只能在配置文件中设置ldapShouldRefreshUserCacheEntries
during startup in the configuration file
or with the --setParameter
option on the command line. ldapShouldRefreshUserCacheEntries
,或者在命令行上使用--setParameter
选项。For example, the following disables 例如,以下命令禁用ldapShouldRefreshUserCacheEntries
:ldapShouldRefreshUserCacheEntries
:
mongod --setParameter ldapShouldRefreshUserCacheEntries=false
maxValidateMemoryUsageMB
New in version 5.0.在版本5.0中新增。
Default默认值: 200
The maximum memory usage limit in megabytes for the validate
command. validate
命令的最大内存使用限制(以MB为单位)。If the limit is exceeded, 如果超过限制,validate
returns as many results as possible and warns that not all corruption might be reported because of the limit.validate
将返回尽可能多的结果,并警告说,由于限制,可能不会报告所有的损坏。
You can set 您可以在启动期间设置maxValidateMemoryUsageMB
during startup, and can change this setting using the setParameter
database command.maxValidateMemoryUsageMB
,并可以使用setParameter
数据库命令更改此设置。
ocspEnabled
New in version 4.4.在版本4.4中新增。 Available on Linux and macOS.可在Linux和macOS上使用。
Default默认值: true
The flag that enables or disables OCSP.启用或禁用OCSP的标志。
You can only set 您只能在配置文件中或命令行上的ocspEnabled
during startup in the configuration file
or with the --setParameter
option on the command line. --setParameter
选项设置启动期间的ocspEnabled
。For example, the following disables OCSP:例如,以下选项禁用OCSP:
mongod --setParameter ocspEnabled=false ...
ocspValidationRefreshPeriodSecs
New in version 4.4.在版本4.4中新增。 Available on Linux.可在Linux上使用。
The number of seconds to wait before refreshing the stapled OCSP status response. 刷新已装订的OCSP状态响应之前等待的秒数。Specify a number greater than or equal to 1.指定一个大于或等于1的数字。
You can only set 您只能在配置文件或命令行上的ocspValidationRefreshPeriodSecs
during startup in the configuration file
or with the --setParameter
option on the command line. --setParameter
选项中设置启动期间的ocspValidationRefreshPeriodSecs
。For example, the following sets the parameter to 3600 seconds:例如,下面将参数设置为3600秒:
mongod --setParameter ocspValidationRefreshPeriodSecs=3600 ...
Starting in MongoDB 5.0, the 从MongoDB 5.0开始,rotateCertificates
command and db.rotateCertificates()
method will also refresh any stapled OCSP responses.rotateCertificates
命令和db.rotateCertificates()
方法也将刷新任何订书的OCSP响应。
opensslCipherConfig
Available on Linux only仅在Linux上可用
Changed in version 4.0.在版本4.0中更改。
opensslCipherConfig
is supported for Linux/BSD and no longer supported in Windows and macOS. opensslCipherConfig
,Windows和macOS不再支持该参数。Specify the cipher string for OpenSSL when using TLS/SSL encryption. 使用TLS/SSL加密时,指定OpenSSL的密码字符串。For a list of cipher strings, see https://www.openssl.org/docs/man1.1.1/man1/ciphers.html. 有关密码字符串列表,请参阅https://www.openssl.org/docs/man1.1.1/man1/ciphers.html。Multiple cipher strings can be provided as a colon-separated list.可以以冒号分隔的列表形式提供多个密码字符串。
This parameter is only for use with TLS 1.2 or earlier. 此参数仅用于TLS 1.2或更早版本。To specify cipher suites for use with TLS 1.3, use the 要指定用于TLS 1.3的密码套件,请使用opensslCipherSuiteConfig
parameter.opensslCipherSuiteConfig
参数。
You can only set 只能在启动期间设置opensslCipherConfig
during start-up, and cannot change this setting using the setParameter
database command.opensslCipherConfig
,不能使用setParameter
数据库命令更改此设置。
For version 4.2 and greater, the use of 对于4.2及更高版本,使用TLS
options is preferred over SSL
options. TLS
选项比使用SSL
选项更可取。The TLS options have the same functionality as the TLS选项与SSL
options. SSL
选项具有相同的功能。For example, the following configures a 例如,下面在MongoDB 4.2中使用mongod
with a opensslCipherConfig
cipher string of 'HIGH:!EXPORT:!aNULL@STRENGTH'
in MongoDB 4.2:opensslCipherConfig
加密字符串'HIGH:!EXPORT:!aNULL@STRENGTH'
配置mongod
:
mongod --setParameter opensslCipherConfig='HIGH:!EXPORT:!aNULL@STRENGTH' --tlsMode requireTLS --tlsCertificateKeyFile Certs/server.pem
For versions 4.0 and earlier:对于4.0及更早版本:
mongod --setParameter opensslCipherConfig='HIGH:!EXPORT:!aNULL@STRENGTH' --sslMode requireSSL --sslPEMKeyFile Certs/server.pem
opensslCipherSuiteConfig
New in version 5.0.在版本5.0中新增。
Available on Linux only仅在Linux上可用
Specify the list of supported cipher suites OpenSSL should permit when using TLS 1.3 encryption.指定使用TLS 1.3加密时OpenSSL应允许的受支持密码套件列表。
For a list of cipher suites for use with TLS 1.3, see https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_set_cipher_list.html. 有关与TLS 1.3一起使用的密码套件列表,请参阅https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_set_cipher_list.html。Multiple cipher suites can be provided as a colon-separated list.可以以冒号分隔的列表形式提供多个密码套件。
This parameter is only for use with TLS 1.3. 此参数仅用于TLS 1.3。To specify cipher strings for use with TLS 1.2 or earlier, use the 要指定用于TLS 1.2或更早版本的密码字符串,请使用opensslCipherConfig
parameter.opensslCipherConfig
参数。
You can only set 只能在启动期间设置opensslCipherSuiteConfig
during start-up, and cannot change this setting using the setParameter
database command. opensslCipherSuiteConfig
,不能使用setParameter
数据库命令更改此设置。For example, the following configures a 例如,下面使用mongod
with a opensslCipherSuiteConfig
cipher suite of 'TLS_AES_256_GCM_SHA384'
for use with TLS 1.3:'TLS_AES_256_GCM_SHA384'
的opensslCipherSuiteConfig
密码套件配置mongod
,用于TLS 1.3:
mongod --setParameter opensslCipherSuiteConfig='TLS_AES_256_GCM_SHA384' --tlsMode requireTLS --tlsCertificateKeyFile Certs/server.pem
opensslDiffieHellmanParameters
Available on Linux only仅在Linux上可用
Specify the path to the PEM file that contains the OpenSSL Diffie-Hellman parameters when using TLS 1.2 or previous. 指定使用TLS 1.2或更早版本时包含OpenSSL Diffie-Hellman参数的PEM文件的路径。Specifying the OpenSSL Diffie-Hellman parameters enables support for Ephemeral Diffie-Hellman (DHE) cipher suites during TLS/SSL encryption.指定OpenSSL Diffie-Hellman参数可以在TLS/SSL加密期间支持短暂的Diffie-Hellman(DHE)密码套件。
This parameter is not supported for use with TLS 1.3.TLS 1.3不支持使用此参数。
Ephemeral Diffie-Hellman (DHE) cipher suites (and Ephemeral Elliptic Curve Diffie-Hellman (ECDHE) cipher suites) provide Forward Secrecy. 瞬时Diffie-Hellman(DHE)密码套件(和瞬时椭圆曲线Diffie-Hellman(ECDHE)密码套件)提供前向保密性。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.这样可以确保即使服务器的私钥被泄露,也无法用泄露的密钥解密过去的会话。
Starting in MongoDB 4.2, if 从MongoDB 4.2开始,如果opensslDiffieHellmanParameters
is unset but ECDHE is enabled, MongoDB enables DHE using the ffdhe3072
Diffie-Hellman parameter, as defined in RFC-7919#appendix-A.2. opensslDiffieHellmanParameters
参数未设置但启用了ECDHE,MongoDB将使用RFC-7919附录A.2中定义的ffdhe3072
Diffie-Hellman参数启用DHE。The ffdhe3072
is a strong parameter (specifically, size is greater than 1024). ffdhe3072
是一个强参数(具体来说,大小大于1024)。Strong parameters are not supported with Java 6 and 7 unless extended support has been purchased from Oracle.Java 6和7不支持强参数,除非从Oracle购买了扩展支持。
You can only set 您只能在启动期间设置opensslDiffieHellmanParameters
during startup, and cannot change this setting using the setParameter
database command.opensslDiffieHellmanParameters
,并且不能使用setParameter
数据库命令更改此设置。
If for performance reasons, you need to disable support for DHE cipher suites, use the 如果出于性能原因,需要禁用对DHE密码套件的支持,请使用opensslCipherConfig
parameter:opensslCipherConfig
参数:
mongod --setParameter opensslCipherConfig='HIGH:!EXPORT:!aNULL:!DHE:!kDHE@STRENGTH' ...
saslauthdPath
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Specify the path to the Unix Domain Socket of the 指定要用于代理身份验证的saslauthd
instance to use for proxy authentication.saslauthd
实例的Unix域套接字的路径。
saslHostName
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
saslHostName
overrides MongoDB's default hostname detection for the purpose of configuring SASL and Kerberos authentication.为了配置SASL和Kerberos身份验证,覆盖MongoDB的默认主机名检测。
saslHostName
does not affect the hostname of the 除了SASL和Kerberos配置之外,不会影响mongod
or mongos
instance for any purpose beyond the configuration of SASL and Kerberos.mongod
或mongos
实例的主机名。
You can only set 你只能在启动期间设置saslHostName
during start-up, and cannot change this setting using the setParameter
database command.saslHostName
,无法使用setParameter
数据库命令更改此设置。
saslHostName
supports Kerberos authentication and is only included in MongoDB Enterprise. For more information, see the following:支持Kerberos身份验证,仅包含在MongoDB Enterprise中。有关更多信息,请参阅以下内容:
saslServiceName
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Allows users to override the default Kerberos service name component of the Kerberos principal name, on a per-instance basis. 允许用户在每个实例的基础上覆盖Kerberos主体名称的默认Kerberos服务名称组件。If unspecified, the default value is 如果未指定,则默认值为mongodb
.mongodb
。
MongoDB only permits setting MongoDB只允许在启动时设置saslServiceName
at startup. saslServiceName
。The setParameter
command can not change this setting.setParameter
命令无法更改此设置。
saslServiceName
is only available in MongoDB Enterprise.仅在MongoDB Enterprise中可用。
Ensure that your driver supports alternate service names.确保驱动程序支持备用服务名称。
scramIterationCount
Default默认值: 10000
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Changes the number of hashing iterations used for all new 更改用于所有新的SCRAM-SHA-1
passwords. SCRAM-SHA-1
密码的哈希迭代次数。More iterations increase the amount of time required for clients to authenticate to MongoDB, but makes passwords less susceptible to brute-force attempts. 更多的迭代会增加客户端向MongoDB进行身份验证所需的时间,但会降低密码对暴力尝试的敏感性。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 scramIterationCount
value must be 5000
or greater.scramIterationCount
值必须为5000
或更大。
For example, the following sets the 例如,下面将scramIterationCount
to 12000
.scramIterationCount
设置为12000
。
mongod --setParameter scramIterationCount=12000
Or, if using the 或者,如果在setParameter
command within mongosh
:mongosh
中使用setParameter
命令:
db.adminCommand( { setParameter: 1, scramIterationCount: 12000 } )
scramSHA256IterationCount
New in version 4.0.在版本4.0中新增。
Default默认值: 15000
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Changes the number of hashing iterations used for all new 更改用于所有新的SCRAM-SHA-256
passwords. SCRAM-SHA-256
密码的哈希迭代次数。More iterations increase the amount of time required for clients to authenticate to MongoDB, but makes passwords less susceptible to brute-force attempts. 更多的迭代会增加客户端向MongoDB进行身份验证所需的时间,但会降低密码对暴力尝试的敏感性。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 scramSHA256IterationCount
value must be 5000
or greater.scramSHA256IterationCount
值必须大于等于5000
。
For example, the following sets the 例如,下面将scramSHA256IterationCount
to 20000
.scramSHA256IterationCount
设置为20000
。
mongod --setParameter scramSHA256IterationCount=20000
Or, if using the 或者,如果在setParameter
command within mongosh
:mongosh
中使用setParameter
命令:
db.adminCommand( { setParameter: 1, scramSHA256IterationCount: 20000 } )
sslMode
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Set the 将net.ssl.mode
to either preferSSL
or requireSSL
. net.ssl.mode
设置为preferSSL
或requireSSL
。Useful during rolling upgrade to TLS/SSL to minimize downtime.在滚动升级到TLS/SSL时非常有用,可最大限度地减少停机时间。
For more information about TLS/SSL and MongoDB, see Configure 有关TLS/SSL和MongoDB的更多信息,请参阅为TLS/SSL配置mongod
and mongos
for TLS/SSL and TLS/SSL Configuration for Clients .mongod
和mongos
以及用于客户端TLS/SSL配置。
db.adminCommand( { setParameter: 1, sslMode: "preferSSL" } )
tlsMode
New in version 4.2.在版本4.2中新增。
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Set to either:
preferTLS
requireTLS
The tlsMode
parameter is useful during rolling upgrade to TLS/SSL to minimize downtime.tlsMode
参数在滚动升级到TLS/SSL期间非常有用,可以最大限度地减少停机时间。
db.adminCommand( { setParameter: 1, tlsMode: "preferTLS" } )
For more information about TLS/SSL and MongoDB, see Configure 有关TLS/SSL和MongoDB的更多信息,请参阅为TLS/SSL配置mongod
and mongos
for TLS/SSL and TLS/SSL Configuration for Clients .mongod
和mongos
以及用于客户端TLS/SSL配置。
tlsOCSPStaplingTimeoutSecs
New in version 4.4.在版本4.4中新增。 Available for Linux适用于Linux.
The maximum number of seconds the mongod
/mongos
instance should wait to receive the OCSP status response for its certificates.mongod
/mongos
实例在接收其证书的OCSP状态响应时应等待的最长秒数。
Specify an integer greater than or equal to (指定一个大于或等于(>=
) 1. >=
)1的整数。If unset, 如果未设置,则tlsOCSPStaplingTimeoutSecs
uses the tlsOCSPVerifyTimeoutSecs
value.tlsOCSPStaplingTimeoutSecs
将使用tlsOCSPVerifyTimeoutSecs
值。
You can only set 您只能在配置文件或命令行上的tlsOCSPStaplingTimeoutSecs
during startup in the configuration file
or with the --setParameter
option on the command line. --setParameter
选项中设置启动期间的tlsOCSPStaplingTimeoutSecs
。For example, the following sets the 例如,下面将tlsOCSPStaplingTimeoutSecs
to 20 seconds:tlsOCSPStaplingTimeoutSecs
设置为20秒:
mongod --setParameter tlsOCSPStaplingTimeoutSecs=20 ...
tlsOCSPVerifyTimeoutSecs
New in version 4.4.在版本4.4中新增。 Available for Linux and Windows.适用于Linux和Windows。
Default默认值: 5
The maximum number of seconds that the 验证客户端证书时,mongod
/mongos
should wait for the OCSP response when verifying client certificates.mongod
/mongos
应等待OCSP响应的最长秒数。
Specify an integer greater than or equal to (指定一个大于或等于(>=
) 1.>=
)1的整数。
You can only set 您只能在配置文件或命令行上的tlsOCSPVerifyTimeoutSecs
during startup in the configuration file
or with the --setParameter
option on the command line. --setParameter
选项中设置启动期间的tlsOCSPVerifyTimeoutSecs
。For example, the following sets the 例如,下面将tlsOCSPVerifyTimeoutSecs
to 20 seconds:tlsOCSPVerifyTimeoutSecs
设置为20秒:
mongod --setParameter tlsOCSPVerifyTimeoutSecs=20 ...
tlsWithholdClientCertificate
Default默认值: false
New in version 4.2.在版本4.2中新增。
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
A TLS certificate is set for a 当未设置mongod
or mongos
either by the --tlsClusterFile
option or by the --tlsCertificateKeyFile
option when --tlsClusterFile
is not set. --tlsClusterFile
时,通过--tlsClusterFile
选项或--tlsCertificateKeyFile
选项为mongod
或mongos
设置TLS证书。If the TLS certificate is set, by default, the instance sends the certificate when initiating intra-cluster communications with other 如果设置了TLS证书,则默认情况下,实例在启动与部署中其他mongod
or mongos
instances in the deployment. mongod
或mongos
实例的集群内通信时发送证书。Set 将tlsWithholdClientCertificate
to 1
or true
to direct the instance to withhold sending its TLS certificate during these communications. tlsWithholdClientCertificate
设置为1
或true
,以指示实例在这些通信期间停止发送其TLS证书。Use this option with 将此选项与部署的所有成员上的--tlsAllowConnectionsWithoutCertificates
(to allow inbound connections without certificates) on all members of the deployment. --tlsAllowConnectionsWithoutCertificates
一起使用(以允许没有证书的入站连接)。tlsWithholdClientCertificate
is mutually exclusive with 与--clusterAuthMode x509
.--clusterAuthMode x509
互斥。
tlsX509ClusterAuthDNOverride
New in version 4.2.在版本4.2中新增。
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
An alternative Distinguished Name (DN) that the instance can also use to identify members of the deployment.实例还可以用来标识部署成员的替代可分辨名称(DN)。
For a MongoDB deployment that uses x.509 certificates for 对于使用x.509证书进行clusterAuthMode
, deployment members identify each other using x.509 certificates (net.tls.clusterFile
, if specified, and net.tls.certificateKeyFile
) during intra-cluster communications. clusterAuthMode
的MongoDB部署,部署成员在集群内通信期间使用x.50 9证书(net.tls.clusterFile
,如果指定,以及net.tls.certificateKeyFile
)相互标识。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).DN
必须具有相同的组织属性(O
)、组织单位属性(OU
)和域组件(DC
)。
If 如果为成员设置了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. tlsX509ClusterAuthDNOverride
,则该成员在比较所提供证书的DN
组件(O
、OU
和DC
)时也可以使用覆盖值。That is the member checks the presented certificates against its 也就是说,成员根据其net.tls.clusterFile
/net.tls.certificateKeyFile
. net.tls.clusterFile
/net.tls.certificateKeyFile
检查提交的证书。If the DN does not match, the member checks the presented certificate against the 如果DN不匹配,成员将根据tlsX509ClusterAuthDNOverride
value.tlsX509ClusterAuthDNOverride
值检查提供的证书。
If set, you must set this parameter on all members of the deployment.如果已设置,则必须在部署的所有成员上设置此参数。
You can use this parameter for a rolling update of certificates to new certificates that contain a new 可以使用此参数将证书滚动更新为包含新DN
value. DN
值的新证书。See Rolling Update of x.509 Cluster Certificates that Contain New DN.请参阅包含新DN的x.509群集证书的滚动更新。
For more information about membership certificate requirements, see Member Certificate Requirements for details.有关会员证书要求的更多信息,请参阅会员证书要求以了解详细信息。
tlsX509ExpirationWarningThresholdDays
New in version 4.4.在版本4.4中新增。
Default默认值 : 30
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Starting in MongoDB 4.4, 从MongoDB 4.4开始,如果提供的x.509证书在mongod
/mongos
logs a warning on connection if the presented x.509 certificate expires within 30
days of the mongod/mongos
system clock. mongod
/mongos
系统时钟30天内过期,mongod
/mongos
会在连接时记录警告。Use the 使用tlsX509ExpirationWarningThresholdDays
parameter to control the certificate expiration warning threshold:tlsX509ExpirationWarningThresholdDays
参数控制证书过期警告阈值:
0
to disable the warning.0
以禁用警告。This parameter has a minimum value of 此参数的最小值为0
.0
。
You can only set 在tlsX509ExpirationWarningThresholdDays
during mongod/mongos
startup using either:mongod
/mongos
启动期间,您只能使用以下选项之一设置tlsX509ExpirationWarningThresholdDays
:
setParameter
configuration setting, orsetParameter
配置设置,或mongod --setParameter
/ mongos --setParameter
command line option.mongod --setParameter
/ mongos --setParameter
命令行选项。See x.509 Certificates Nearing Expiry Trigger Warnings for more information on x.509 expiration warnings in MongoDB 4.4.有关MongoDB 4.4中x.509到期警告的更多信息,请参阅x.509证书即将到期触发警告。
For more information on x.509 certificate validity, see RFC 5280 4.1.2.5.有关x.509证书有效性的更多信息,请参阅RFC 5280 4.1.2.5。
sslWithholdClientCertificate
Default默认值: false
Deprecated since version 4.2自4.2版以来已弃用: Use :请改用tlsWithholdClientCertificate
instead.tlsWithholdClientCertificate
。
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
A TLS certificate is set for a 当未设置--tlsClusterFile时,可以通过mongod
or mongos
either by the --tlsClusterFile
option or by the --tlsCertificateKeyFile
option when --tlsClusterFile
is not set. --tlsClusterFile
选项或--tlsCertificateKeyFile
选项为mongod
或mongos
设置TLS证书。If the TLS certificate is set, by default, the instance sends the certificate when initiating intra-cluster communications with other 如果设置了TLS证书,默认情况下,实例在启动与部署中的其他mongod
or mongos
instances in the deployment. mongod
或mongos
实例的集群内通信时发送证书。Set 将sslWithholdClientCertificate
to 1
or true
to direct the instance to withhold sending its TLS certificate during these communications. sslWithholdClientCertificate
设置为1
或true
,以指示实例在这些通信期间不发送其TLS证书。Use this option with 将此选项与部署的所有成员上的--tlsAllowConnectionsWithoutCertificates
(to allow inbound connections without certificates) on all members of the deployment. --tlsAllowConnectionsWithoutCertificates
(允许无证书的入站连接)一起使用。sslWithholdClientCertificate
is mutually exclusive with 与--clusterAuthMode x509
.--clusterAuthMode x509
互斥。
userCacheInvalidationIntervalSecs
Default默认值: 30
Available for 仅适用于mongos
only.mongos
。
On a 在mongos
instance, specifies the interval (in seconds) at which the mongos
instance checks to determine whether the in-memory cache of user objects has stale data, and if so, clears the cache. mongos
实例上,指定mongos
实例检查以确定用户对象的内存缓存是否有过时数据的间隔(以秒为单位),如果有,则清除缓存。If there are no changes to user objects, 如果用户对象没有更改,mongos
will not clear the cache.mongos
将不会清除缓存。
This parameter has a minimum value of 该参数的最小值为1
second and a maximum value of 86400
seconds (24 hours).1
秒,最大值为86400
秒(24小时)。
authFailedDelayMs
Default默认值: 0
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
The number of milliseconds to wait before informing clients that their authentication attempt has failed. 通知客户端身份验证尝试失败之前等待的毫秒数。This parameter may be in the range 此参数可能在0到5000之间(含0
to 5000
, inclusive.0
到5000
)。
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.但是,等待MongoDB服务器响应的客户端仍然会消耗服务器资源,如果服务器同时拒绝访问许多其他客户端,这可能会对良性登录尝试产生不利影响。
allowRolesFromX509Certificates
Default默认值: true
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Available starting in MongoDB 4.0.11 (and 3.6.14 and 3.4.22)从MongoDB 4.0.11(以及3.6.14和3.4.22)开始提供
A boolean flag that allows or disallows the retrieval of authorization roles from client x.509 certificates.允许或不允许从客户端x.509证书检索授权角色的布尔标志。
You can only set 在启动期间,只能在配置文件或命令行中设置allowRolesFromX509Certificates
during startup in the config file or on the command line.allowRolesFromX509Certificates
。
connPoolMaxShardedConnsPerHost
Default默认值: 200
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Sets the maximum size of the legacy connection pools for communication to the shards. 设置用于与碎分片通信的旧连接池的最大大小。The size of a pool does not prevent the creation of additional connections, but does prevent the connection pools from retaining connections above this limit.池的大小不会阻止创建其他连接,但会阻止连接池保留超过此限制的连接。
The parameter is separate from the connections in TaskExecutor pools. 该参数与TaskExecutor池中的连接是分开的。See 请参阅ShardingTaskExecutorPoolMaxSize
.ShardingTaskExecutorPoolMaxSize
。
Increase the 仅当连接池中的连接数具有较高的搅动级别或创建的连接总数增加时,才增加connPoolMaxShardedConnsPerHost
value only if the number of connections in a connection pool has a high level of churn or if the total number of created connections increase.connPoolMaxShardedConnsPerHost
值。
You can only set 在启动期间,只能在配置文件或命令行中设置connPoolMaxShardedConnsPerHost
during startup in the config file or on the command line. connPoolMaxShardedConnsPerHost
。For example:
mongos --setParameter connPoolMaxShardedConnsPerHost=250
connPoolMaxShardedInUseConnsPerHost
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Sets the maximum number of in-use connections at any given time for the legacy sharded cluster connection pools.设置旧分分片群集连接池在任何给定时间的最大在用连接数。
By default, the parameter is unset.默认情况下,该参数是未设置的。
You can only set 在启动期间,只能在配置文件或命令行中设置connPoolMaxShardedConnsPerHost
during startup in the config file or on the command line. connPoolMaxShardedConnsPerHost
。For example:例如:
mongos --setParameter connPoolMaxShardedInUseConnsPerHost=100
shardedConnPoolIdleTimeoutMinutes
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Sets the time limit that a connection in the legacy sharded cluster connection pool can remain idle before being closed.设置旧分分片群集连接池中的连接在关闭前可以保持空闲的时间限制。
By default, the parameter is unset.默认情况下,该参数是未设置的。
You can only set 在启动期间,只能在配置文件或命令行中设置shardedConnPoolIdleTimeoutMinutes
during startup in the config file or on the command line. shardedConnPoolIdleTimeoutMinutes
。For example:例如:
mongos --setParameter shardedConnPoolIdleTimeoutMinutes=10
connPoolMaxConnsPerHost
Default默认值: 200
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Sets the maximum size of the legacy connection pools for outgoing connections to other 设置与全局连接池中其他mongod
instances in the global connection pool. mongod
实例的传出连接的旧连接池的最大大小。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 池的大小不会阻止创建其他连接,但会阻止连接池保留超过connPoolMaxConnsPerHost
.connPoolMaxConnsPerHost
值的连接。
The parameter is separate from the connections in TaskExecutor pools. 该参数与TaskExecutor池中的连接是分开的。See 请参阅ShardingTaskExecutorPoolMaxSize
.ShardingTaskExecutorPoolMaxSize
。
Only adjust this setting if your driver does not pool connections and you're using authentication in the context of a sharded cluster.仅当驱动程序不共享连接,并且您在分分片集群的上下文中使用身份验证时,才调整此设置。
You can only set 在启动期间,只能在配置文件或命令行中设置connPoolMaxConnsPerHost
during startup in the config file or on the command line. connPoolMaxConnsPerHost
。For example:例如:
mongod --setParameter connPoolMaxConnsPerHost=250
connPoolMaxInUseConnsPerHost
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Sets the maximum number of in-use connections at any given time for for outgoing connections to other 设置任何给定时间的最大正在使用连接数,用于与传统全局连接池中其他mongod
instances in the legacy global connection pool.mongod
实例的传出连接。
By default, the parameter is unset.默认情况下,该参数是未设置的。
You can only set 在启动期间,只能在配置文件或命令行中设置connPoolMaxInUseConnsPerHost
during startup in the config file or on the command line. connPoolMaxInUseConnsPerHost
。For example:例如:
mongod --setParameter connPoolMaxInUseConnsPerHost=100
globalConnPoolIdleTimeoutMinutes
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Sets the time limit that connection in the legacy global connection pool can remain idle before being closed.设置旧全局连接池中的连接在关闭之前保持空闲的时间限制。
By default, the parameter is unset.默认情况下,该参数未设置。
You can only set 您只能在配置文件或命令行中设置启动期间的globalConnPoolIdleTimeoutMinutes
during startup in the config file or on the command line. globalConnPoolIdleTimeoutMinutes
。For example:例如:
mongos --setParameter globalConnPoolIdleTimeoutMinutes=10
cursorTimeoutMillis
Default默认值: 600000 (10 minutes)
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Sets the expiration threshold in milliseconds for idle cursors before MongoDB removes them; specifically, MongoDB removes cursors that have been idle for the specified 在MongoDB删除空闲游标之前,设置空闲游标的过期阈值(毫秒);具体地说,MongoDB删除在指定的cursorTimeoutMillis
.cursorTimeoutMillis
中空闲的游标。
For example, the following sets the 例如,下面将cursorTimeoutMillis
to 300000
milliseconds (5 minutes).cursorTimeoutMillis
设置为300000
毫秒(5分钟)。
mongod --setParameter cursorTimeoutMillis=300000
Or, if using the 或者,如果在setParameter
command within mongosh
:mongosh
中使用setParameter
命令:
db.adminCommand( { setParameter: 1, cursorTimeoutMillis: 300000 } )
Setting 将cursorTimeoutMillis
to less than or equal to 0
results in all cursors being immediately eligible for timeout. cursorTimeoutMillis
设置为小于或等于0将导致所有游标立即符合超时条件。Generally, the timeout value should be greater than the average amount of time for a query to return results. 通常,超时值应该大于查询返回结果的平均时间。Use tools like the 使用诸如cursor.explain()
cursor modifier to analyze the average query time and select an appropriate timeout period.cursor.explain()
游标修饰符之类的工具来分析平均查询时间并选择适当的超时时间。
failIndexKeyTooLong
Removed in 4.4在4.4中删除
cursorTimeoutMillis
parameter. cursorTimeoutMillis
参数。failIndexKeyTooLong
parameter and removes the Index Key Length Limit for featureCompatibilityVersion (fCV) set to "4.2"
or greater.failIndexKeyTooLong
参数,并对设置为“4.2”或更高的featureCompatibilityVersion (fCV) 删除了索引密钥长度限制。For MongoDB 2.6 through MongoDB versions with featureCompatibilityVersion (fCV) set to 对于featureCompatibilityVersion(fCV)设置为“4.0”或更早版本的MongoDB 2.6到MongoDB版本,适用索引密钥长度限制。"4.0"
or earlier, Index Key Length Limit applies. If you attempt to insert or update a document whose index field exceeds the Index Key Length Limit, the operation will fail and return an error to the client.如果尝试插入或更新索引字段超过索引键长度限制的文档,则操作将失败并向客户端返回错误。
To avoid this issue, consider using hashed indexes or indexing a computed value. 为避免此问题,请考虑使用散列索引或对计算值进行索引。If you have an existing data set and want to disable this behavior so you can upgrade and then gradually resolve these indexing issues, you can use 如果您有一个现有的数据集并希望禁用此行为,以便可以升级并逐步解决这些索引问题,可以使用failIndexKeyTooLong
to disable this behavior.failIndexKeyTooLong
禁用此行为。
Setting 将failIndexKeyTooLong
to false
is a temporary workaround, not a permanent solution to the problem of oversized index keys. failIndexKeyTooLong
设置为false
是一种临时解决方案,而不是解决索引键过大问题的永久解决方案。With 当failIndexKeyTooLong
set to false
, queries can return incomplete results if they use indexes that skip over documents whose indexed fields exceed the Index Key Length Limit.failIndexKeyTooLong
设置为false
时,如果查询使用的索引跳过索引字段超过索引键长度限制的文档,则可能返回不完整的结果。
failIndexKeyTooLong
defaults to 默认为true
.true
。
Issue the following command to disable the index key length validation:发出以下命令以禁用索引键长度验证:
db.adminCommand( { setParameter: 1, failIndexKeyTooLong: false } )
You can also set 您还可以使用以下选项在启动时设置failIndexKeyTooLong
at startup with the following option:failIndexKeyTooLong
:
mongod --setParameter failIndexKeyTooLong=false
notablescan
Available for 仅适用于mongod
only.mongod
。
Specify whether all queries must use indexes. 指定是否所有查询都必须使用索引。If 如果为1
, MongoDB will not execute queries that require a collection scan and will return an error.1
,MongoDB将不执行需要集合扫描的查询,并返回错误。
Consider the following example which sets 考虑以下将notablescan
to 1
or true:notablescan
设置为1
或true
的示例:
db.adminCommand( { setParameter: 1, notablescan: 1 } )
Setting 将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.notablescan
设置为1
对于测试应用程序查询非常有用,例如,可以识别扫描整个集合并且不能使用索引的查询。
To detect unindexed queries without 要检测没有notablescan
, consider reading the Evaluate Performance of Current Operations and Optimize Query Performance sections and using the logLevel
parameter, mongostat
and profiling.notablescan
的未索引查询,请考虑阅读评估当前操作的性能和优化查询性能部分,并使用logLevel
参数、mongostat
和profiling。
Don't run production 不要使用mongod
instances with notablescan
because preventing collection scans can potentially affect queries in all databases, including administrative queries.notablescan
运行生产mongod
实例,因为阻止集合扫描可能会影响所有数据库中的查询,包括管理查询。
ttlMonitorEnabled
Available for 仅适用于mongod
only.mongod
。
Default默认值: true
To support TTL Indexes, 为了支持TTL索引,mongod
instances have a background thread that is responsible for deleting documents from collections with TTL indexes.mongod
实例有一个后台线程,负责从具有TTL索引的集合中删除文档。
To disable this worker thread for a 要禁用mongod
, set ttlMonitorEnabled
to false
, as in the following operations:mongod
的此工作线程,请将ttlMonitorEnabled
设置为false
,如下操作所示:
db.adminCommand( { setParameter: 1, ttlMonitorEnabled: false } )
Alternately, you may disable the thread at startup time by starting the 或者,您可以在启动时使用以下选项启动mongod
instance with the following option:mongod
实例来禁用线程:
mongod --setParameter ttlMonitorEnabled=false
Do not run production 除非在MongoDB支持的指导下,否则不要在禁用mongod
instances with ttlMonitorEnabled
disabled, except under guidance from MongoDB support. ttlMonitorEnabled
的情况下运行生产mongod
实例。Preventing TTL document removal can negatively impact MongoDB internal system operations that depend on TTL Indexes.防止删除TTL文档可能会对依赖于TTL索引的MongoDB内部系统操作产生负面影响。
tcpFastOpenServer
New in version 4.4.在版本4.4中新增。
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Default默认值: true
Enables support for accepting inbound TCP Fast Open (TFO) connections to the 支持从客户端接受到mongod/mongos
from a client. mongod
/mongos
的入站TCP快速开放(TFO)连接。TFO requires both the client and TFO需要客户端和mongod/mongos
host machine support and enable TFO:mongod
/mongos
主机支持,并启用TFO:
The following Windows operating systems support TFO:以下Windows操作系统支持TFO:
Linux operating systems running Linux Kernel 3.7 or later can support inbound TFO.运行Linux内核3.7或更高版本的Linux操作系统可以支持入站TFO。
Set the value of 设置/proc/sys/net/ipv4/tcp_fastopen
to enable inbound TFO connections:/proc/sys/net/ipv4/tcp_fastopen
的值以启用入站TFO连接:
2
to enable only inbound TFO connections.2
以仅启用入站TFO连接。3
to enable inbound and outbound TFO connections.3
可启用入站和出站TFO连接。This parameter has no effect if the host operating system does not support or is not configured to support TFO connections.如果主机操作系统不支持或未配置为支持TFO连接,则此参数无效。
You can only set this parameter on startup, using either the 只能在启动时使用setParameter
configuration file setting or the --setParameter
command line option.setParameter
配置文件设置或--setParameter
命令行选项设置此参数。
See Support for TCP Fast Open for more information on MongoDB TFO support.有关MongoDB TFO支持的更多信息,请参阅支持TCP Fast Open。
tcpFastOpenClient
New in version 4.4.在版本4.4中新增。
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Default默认值: true
Linux Operating System Only仅Linux操作系统
Enables support for outbound TCP Fast Open (TFO) connections from the 支持从mongod/mongos
to a client. mongod
/mongos
到客户端的出站TCP快速开放(TFO)连接。TFO requires both the client and the TFO需要客户端和mongod/mongos
host machine support and enable TFO.mongod
/mongos
主机支持并启用TFO。
Linux operating systems running Linux Kernel 4.11 or later can support outbound TFO.运行Linux内核4.11或更高版本的Linux操作系统可以支持出站TFO。
Set the value of 设置/proc/sys/net/ipv4/tcp_fastopen
to enable outbound TFO connections:/proc/sys/net/ipv4/tcp_fastopen
的值以启用出站TFO连接:
1
3
This parameter has no effect if the host operating system does not support or is not configured to support TFO connections.如果主机操作系统不支持或未配置为支持TFO连接,则此参数无效。
You can only set this parameter on startup, using either the 您只能在启动时使用setParameter
configuration file setting or the --setParameter
command line option.setParameter
配置文件设置或--setParameter
命令行选项设置此参数。
See Support for TCP Fast Open for more information on MongoDB TFO support.有关MongoDB TFO支持的更多信息,请参阅支持TCP Fast Open。
tcpFastOpenQueueSize
New in version 4.4.在版本4.4中新增。
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Default默认值: 1024
As part of establishing a TCP Fast Open (TFO) connection, the client submits a valid TFO cookie to the 作为建立TCP快速打开(TFO)连接的一部分,客户端在完成标准TCP三次握手之前,向mongod/mongos
beforecompletion of the standard TCP 3-way handshake. mongod
/mongos
提交一个有效的TFO cookie。The mongod/mongos
keeps a queue of all such pending TFO connections.mongod
/mongos
保持所有此类挂起的TFO连接的队列。
The tcpFastOpenQueueSize
parameter sets the size of the queue of pending TFO connections. tcpFastOpenQueueSize
参数设置挂起TFO连接的队列大小。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. mongod
/mongos
返回到传入客户端请求的正常三方握手,并忽略TFO cookie的存在。Once the queue size falls back below the limit, the 一旦队列大小回落到限制以下,mongod/mongos
begins accepting new TFO cookies.mongod
/mongos
就开始接受新的TFO cookie。
Decreasing the default queue size may reduce the risk of resource server resource exhaustion due to excessive incoming TFO requests. 减小默认队列大小可能会降低由于传入的TFO请求过多而导致资源服务器资源耗尽的风险。However, small queue sizes may also reduce the effect of TFO on network performance.然而,较小的队列大小也可能会降低TFO对网络性能的影响。
The minimum queue size is 最小队列大小为0
. 0
。A queue of 队列0
effectively disables TFO.0
实际上禁用了TFO。
This parameter has no effect on host operating systems that do not support or are not configured for TFO connections. 此参数对不支持或未配置TFO连接的主机操作系统没有影响。See Support for TCP Fast Open for more information on MongoDB TFO support.有关MongoDB TFO支持的更多信息,请参阅支持TCP Fast Open。
disableJavaScriptJIT
Changed in version 4.0.在版本4.0中更改。
Available for 仅适用于mongod
only.mongod
。
The MongoDB JavaScript engine uses SpiderMonkey, which implements Just-in-Time (JIT) compilation for improved performance when running scripts.MongoDB JavaScript引擎使用SpiderMonkey,该引擎实现实时(JIT)编译,以提高运行脚本时的性能。
To enable the JIT, set 要启用JIT,请将disableJavaScriptJIT
to false
, as in the following example:disableJavaScriptJIT
设置为false
,如下例所示:
db.adminCommand( { setParameter: 1, disableJavaScriptJIT: false } )
$where
will reuse existing JavaScript interpreter contexts, so changes to 将重用现有的JavaScript解释器上下文,因此对disableJavaScriptJIT
may not take effect immediately for these operations.disableJavaScriptJIT
的更改可能不会对这些操作立即生效。
Alternately, you may enable the JIT at startup time by starting the 或者,您可以通过使用以下选项启动mongod
instance with the following option:mongod
实例,在启动时启用JIT:
mongod --setParameter disableJavaScriptJIT=false
indexMaxNumGeneratedKeysPerDocument
New in version 5.3.在版本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 可以提高限制,但如果操作需要的键多于indexMaxNumGeneratedKeysPerDocument
parameter specifies, the operation will fail.indexMaxNumGeneratedKeysPerDocument
参数指定的键,则操作将失败。
maxIndexBuildMemoryUsageMegabytes
Default默认值:
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 指定的内存量在使用单个createIndexes
command or its shell helper db.collection.createIndexes()
.createIndexes
命令或其shell助手db.collection.createIndexes()
构建的所有索引之间共享。
The memory consumed by an index build is separate from the WiredTiger cache memory (see 索引构建所消耗的内存与WiredTiger缓存内存是分开的(请参阅cacheSizeGB
).cacheSizeGB
)。
Index builds may be initiated either by a user command such as Create Index or by an administrative process such as an initial sync. 索引构建可以由用户命令(如创建索引)或管理过程(如初始同步)启动。Both are subject to the limit set by maxIndexBuildMemoryUsageMegabytes
.
An initial sync operation populates only one collection at a time and has no risk of exceeding the memory limit. 初始同步操作一次只填充一个集合,没有超过内存限制的风险。However, it is possible for a user to start index builds on multiple collections in multiple databases simultaneously and potentially consume an amount of memory greater than the limit set in 但是,用户可以同时在多个数据库中的多个集合上启动索引构建,并且可能会消耗大于maxIndexBuildMemoryUsageMegabytes
.maxIndexBuildMemoryUsageMegabytes
中设置的限制的内存量。
To minimize the impact of building an index on replica sets and sharded clusters with replica set shards, use a rolling index build procedure as described on Rolling Index Builds on Replica Sets.要最小化使用副本集分片在副本集和分片群集上构建索引的影响,请使用滚动索引构建过程,如在副本集上滚动索引构建中所述。
Changed in version 4.2.在版本4.2中更改。
"4.2"
, the index build memory limit applies to all index builds."4.0"
, the index build memory limit only applies to foreground index builds.reportOpWriteConcernCountersInServerStatus
New in version 4.0.6.在版本4.0.6中新增。
Default默认值: false
A boolean flag that determines whether the 一个布尔标志,用于确定db.serverStatus()
method and serverStatus
command return opWriteConcernCounters
information. db.serverStatus()
方法和serverStatus
命令是否返回opWriteConcernCounters
信息。[1]
You can only set 在启动期间,只能在配置文件或命令行中设置reportOpWriteConcernCountersInServerStatus
during startup in the config file or on the command line. reportOpWriteConcernCountersInServerStatus
。For example:例如:
mongod --setParameter reportOpWriteConcernCountersInServerStatus=true
[1] | reportOpWriteConcernCountersInServerStatus can have a negative performance impact; specifically, when running without TLS.reportOpWriteConcernCountersInServerStatus 可能会对性能产生负面影响;特别是在没有TLS的情况下运行时。 |
watchdogPeriodSeconds
Available for 仅适用于mongod
only.mongod
。
Type类型: integer
Default默认值: -1 (disabled)
Determines how frequent the Storage Node Watchdog checks the status of the monitored filesystems:确定存储节点看门狗检查受监视文件系统状态的频率:
--dbpath
directory--dbpath
目录journal
directory inside the --dbpath
directory if journaling
is enabledjournaling
,--dbpath
目录中的journal
目录--logpath
file--logpath
文件的目录--auditPath
file--auditPath
文件的目录Valid values for watchdogPeriodSeconds
are:watchdogPeriodSeconds
的有效值为:
-1
(the default), to disable/pause Storage Node Watchdog, or-1
(默认值),禁用/暂停Storage Node Watchdog,或watchdogPeriodSeconds
to terminate the mongod
.watchdogPeriodSeconds
值的两倍才能终止mongod
。mongod
uses storage.directoryPerDB: true
(or --directoryperdb
) and symlinks a database directory to another volume, the Storage Node Watchdog does not follow the symlink to monitor the target.mongod
使用storage.directoryPerDB: true
(或--directoryperdb
)并将数据库目录符号链接到另一个卷,则Storage Node Watchdog不会跟随符号链接来监视目标。To enable Storage Node Watchdog, 要启用Storage Node Watchdog,必须在启动期间设置watchdogPeriodSeconds
must be set during startup.watchdogPeriodSeconds
。
mongod --setParameter watchdogPeriodSeconds=60
You can only enable the Storage Node Watchdog at startup. 您只能在启动时启用Storage Node Watchdog。However, once enabled, you can pause the Storage Node Watchdog or change the 但是,一旦启用,您可以在运行时暂停Storage Node Watchdog或更改watchdogPeriodSeconds
during runtime.watchdogPeriodSeconds
。
Once enabled,一旦启用,
To pause the Storage Node Watchdog during runtime, set 要在运行时暂停Storage Node Watchdog,请将watchdogPeriodSeconds
to -1.watchdogPeriodSeconds
设置为-1。
db.adminCommand( { setParameter: 1, watchdogPeriodSeconds: -1 } )
To resume or change the period during runtime, set 要在运行时恢复或更改时段,请将watchdogPeriodSeconds
to a number greater than or equal to 60.watchdogPeriodSeconds
设置为大于或等于60的数字。
db.adminCommand( { setParameter: 1, watchdogPeriodSeconds: 120 } )
It is an error to set 如果在启动时未启用Storage Node Watchdog,则在运行时设置watchdogPeriodSeconds
at runtime if the Storage Node Watchdog was not enabled at startup time.watchdogPeriodSeconds
是错误的。
tcmallocReleaseRate
New in version 4.2.3.在版本4.2.3中新增。 Also available in 3.6.17+ and 4.0.14+
Default: 1.0默认值:1.0
Specifies the tcmalloc release rate (TCMALLOC_RELEASE_RATE). 指定tcmalloc释放速率(TCMALLOC_RELEASE_RATE)。Per https://gperftools.github.io/gperftools/tcmalloc.html#runtime TCMALLOC_RELEASE_RATE is described as the "Rate at which we release unused memory to the system, via madvise(MADV_DONTNEED), on systems that support it. 每https://gperftools.github.io/gperftools/tcmalloc.html#runtime TCMALLOC_RELEASE_RATE被描述为“在支持它的系统上,通过madvise(MADV_DONTNEED)将未使用的内存释放到系统的速率。Zero means we never release memory back to the system. 零意味着我们永远不会将内存释放回系统。Increase this flag to return memory faster; decrease it to return memory slower. Reasonable rates are in the range [0,10]."增加此标志以更快地返回内存;减小该值以减慢返回内存的速度。合理费率在[0,10]范围内。”
To modify the release rate during runtime, you can use the 要在运行时修改释放率,可以使用setParameter
command; for example:setParameter
命令;例如:
db.adminCommand( { setParameter: 1, tcmallocReleaseRate: 5.0 } )
You can also set 您还可以在启动时设置tcmallocReleaseRate
at startup time; for example:tcmallocReleaseRate
;例如:
mongod --setParameter "tcmallocReleaseRate=5.0"
fassertOnLockTimeoutForStepUpDown
New in version 5.3.在版本5.3中新增。
Default: 15 seconds默认值:15秒
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
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. 默认为15秒。To disable nodes from fasserting, set 要禁用节点快速插入,请将fassertOnLockTimeoutForStepUpDown=0
.fassertOnLockTimeoutForStepUpDown
设置为0。
The following example disables nodes from fasserting:以下示例禁用节点快速插入:
mongod --setParameter fassertOnLockTimeoutForStepUpDown=0
logLevel
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Specify an integer between 指定一个介于0
and 5
signifying the verbosity of the logging, where 5
is the most verbose. 0
和5
之间的整数,表示日志的详细性,其中5是最详细的。[2]
The default 默认logLevel
is 0
(Informational).logLevel
为0
(信息)。
The following example sets the 以下示例将logLevel
to 2
:logLevel
设置为2
:
db.adminCommand( { setParameter: 1, logLevel: 2 } )
[2] | D2 . D2 。D for Debug level.D 。 |
logComponentVerbosity
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Sets the verbosity levels of various components for log messages. 设置日志消息的各个组件的详细级别。The verbosity level determines the amount of Informational and Debug messages MongoDB outputs. 详细级别决定MongoDB输出的信息和调试消息的数量。[3]
The verbosity level can range from 详细级别的范围为0
to 5
:0
到5
:
0
is the MongoDB's default log verbosity level, to include Informational messages.0
是MongoDB的默认日志详细级别,包括信息消息。1
to 5
increases the verbosity level to include Debug messages.1
到5
将增加详细级别以包括调试消息。For a component, you can also specify 对于组件,还可以指定-1
to inherit the parent's verbosity level.-1
来继承父级的详细级别。
To specify the verbosity level, use a document similar to the following:要指定详细级别,请使用类似以下文档:
{ verbosity: <int>, <component1>: { verbosity: <int> }, <component2>: { verbosity: <int>, <component3>: { verbosity: <int> } }, ... }
For the components, you can specify just the 对于组件,您可以只在文档中指定<component>: <int>
in the document, unless you are setting both the parent verbosity level and that of the child component(s) as well:<component>: <int>
,除非您同时设置父组件和子组件的详细级别:
{ verbosity: <int>, <component1>: <int> , <component2>: { verbosity: <int>, <component3>: <int> } ... }
The top-level 顶级verbosity
field corresponds to systemLog.verbosity
which sets the default level for all components. verbosity
字段对应于systemLog.verbosity
,它设置所有组件的默认级别。The default value of systemLog.verbosity
is 0
.systemLog.verbosity
的默认值为0
。
The components correspond to the following settings:这些组件对应于以下设置:
accessControl
command
control
ftdc
geo
index
network
query
replication
replication.election
replication.heartbeats
replication.initialSync
replication.rollback
recovery
sharding
storage
storage.journal
transaction
write
Unless explicitly set, the component has the verbosity level of its parent. 除非明确设置,否则组件具有其父级的详细级别。For example, 例如,storage
is the parent of storage.journal
. storage
是storage.journal
的父级。That is, if you specify a 也就是说,如果指定storage
verbosity level, this level also applies to:storage
详细级别,该级别也适用于:
storage.journal
components unless you specify the verbosity level for storage.journal
.storage.journal
组件,除非指定storage.journal
的详细级别。storage.recovery
components unless you specify the verbosity level for storage.recovery
.storage.recovery
组件,除非您指定storage.recovery
的详细级别。For example, the following sets the 例如,下面将默认的详细级别设置为default verbosity level
to 1
, the query
to 2
, the storage
to 2
, and the storage.journal
to 1
.1
,将query
设置为2
,将storage
设置为2
以及将storage.journal
设置为1
。
db.adminCommand( { setParameter: 1, logComponentVerbosity: { verbosity: 1, query: { verbosity: 2 }, storage: { verbosity: 2, journal: { verbosity: 1 } } } } )
You can also set parameter 您还可以在启动时设置参数logComponentVerbosity
at startup time, passing the verbosity level document as a string.logComponentVerbosity
,将详细级别文档作为字符串传递。
mongod --setParameter "logComponentVerbosity={command: 3}"
mongosh
also provides the db.setLogLevel()
to set the log level for a single component. mongosh
还提供了db.setLogLevel()
来设置单个组件的日志级别。For various ways to set the log verbosity level, see Configure Log Verbosity Levels.有关设置日志详细级别的各种方法,请参阅配置日志详细级别。
[3] | D2 . D2 。D for Debug level.D 。 |
maxLogSizeKB
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Type类型: non-negative integer:非负整数
Default默认值: 10
Specifies the maxium size, in kilobytes, for an individual attribute field in a log entry; attributes exceeding this limit are truncated.指定日志条目中单个属性字段的最大大小(以KB为单位);超过此限制的属性将被截断。
Truncated attribute fields print field content up to the 截短的属性字段打印的字段内容达到maxLogSizeKB
limit and excise field content past that limit, retaining valid JSON formating. maxLogSizeKB
的限制,并删除超过该限制的字段内容,保留有效的JSON格式。Log entires that contain truncated attributes append a 包含截断属性的日志实体将截断对象附加到日志条目的末尾。truncated
object to the end of the log entry.
See log message truncation for more information.有关详细信息,请参阅日志消息截断。
A value of 值为0
disables truncation entirely. Negative values for this parameter are not valid.0
将完全禁用截断。此参数的负值无效。
Using a large value, or disabling truncation with a value of 使用较大的值或禁用值为0的截断可能会对系统性能产生负面影响,并对数据库操作产生负面影响。0
, may adversely affect system performance and negatively impact database operations.
The following example sets the maximum log line size to 以下示例将最大日志行大小设置为20
kilobytes:20
KB:
mongod --setParameter maxLogSizeKB=20
quiet
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Sets quiet logging mode. 设置安静日志记录模式。If 如果为1,1
, mongod
will go into a quiet logging mode which will not log the following events/activities:mongod
将进入安静日志模式,该模式不会记录以下事件/活动:
drop
command, the dropIndexes
command, the diagLogging
command, the validate
command; anddrop
命令、dropIndexes
命令、diagLogging
命令、validate
命令;以及Consider the following example which sets the 考虑以下将quiet
parameter to 1
:quiet
参数设置为1
的示例:
db.adminCommand( { setParameter: 1, quiet: 1 } )
redactClientLogData
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Type类型: boolean
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中可用。
Configure the 配置mongod
or mongos
to redact any message accompanying a given log event before logging. mongod
或mongos
,以便在记录之前编辑伴随给定日志事件的任何消息。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 将redactClientLogData
in conjunction with Encryption at Rest and TLS/SSL (Transport Encryption) to assist compliance with regulatory requirements.redactClientLogData
与静态加密和TLS/SSL(传输加密)结合使用,以帮助遵守法规要求。
To enable log redaction on a running 要在运行的mongod
or mongos
, use the following command:mongod
或mongos
上启用日志编校,请使用以下命令:
db.adminCommand( { setParameter: 1, redactClientLogData : true } )
traceExceptions
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Configures 将mongod
to log full source code stack traces for every database and socket C++ exception, for use with debugging. mongod
配置为记录每个数据库和套接字C++异常的完整源代码堆栈跟踪,以用于调试。If 如果为true
, mongod
will log full stack traces.true
,mongod
将记录整个堆栈跟踪。
Consider the following example which sets the 考虑以下将traceExceptions
to true
:traceExceptions
设置为true
的示例:
db.adminCommand( { setParameter: 1, traceExceptions: true } )
suppressNoTLSPeerCertificateWarning
New in version 4.0.1.在版本4.0.1中新增。
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Type类型: boolean
Default默认值: false
By default, a 默认情况下,启用TLS/SSL并且mongod
or mongos
with TLS/SSL enabled and net.ssl.allowConnectionsWithoutCertificates
: true
lets clients connect without providing a certificate for validation while logging an warning. net.ssl.allowConnectionsWithoutCertificates
的mongod
或mongos
允许客户端在记录警告时进行连接,而无需提供验证证书。Set 将suppressNoTLSPeerCertificateWarning
to 1
or true
to suppress those warnings.suppressNoTLSPeerCertificateWarning
设置为1
或true
以抑制这些警告。
The following operation sets 以下操作将suppressNoTLSPeerCertificateWarning
to true
:suppressNoTLSPeerCertificateWarning
设置为true
:
db.adminCommand( { setParameter: 1, suppressNoTLSPeerCertificateWarning: true} )
To facilitate analysis of the MongoDB server behavior by MongoDB engineers, MongoDB logs server statistics to diagnostic files at periodic intervals.为了便于MongoDB工程师分析MongoDB服务器行为,MongoDB定期将服务器统计信息记录到诊断文件中。
For 对于mongod
, the diagnostic data files are stored in the diagnostic.data
directory under the mongod
instance's --dbpath
or storage.dbPath
.mongod
,诊断数据文件存储在mongod
实例的--dbpath
的diagnostic.data
目录中或storage.dbPath
下。
For 对于mongos
, the diagnostic data files, by default, are stored in a directory under the mongos
instance's --logpath
or systemLog.path
directory. mongos
,默认情况下,诊断数据文件存储在mongos
实例的--logpath
的目录中或systemLog.path
目录下。The diagnostic data directory is computed by truncating the logpath's file extension(s) and concatenating 诊断数据目录是通过截断日志路径的文件扩展名并将diagnostic.data
to the remaining name.diagnostic.data
连接到其余名称来计算的。
For example, if 例如,如果mongos
has --logpath /var/log/mongodb/mongos.log.201708015
, then the diagnostic data directory is /var/log/mongodb/mongos.diagnostic.data/
directory. mongos
有--logpath /var/log/mongodb/mongos.log.201708015
,则诊断数据目录为/var/log/mongodb/mongos.diagnostic.data/
。To specify a different diagnostic data directory for 要为mongos
, set the diagnosticDataCollectionDirectoryPath
parameter.mongos
指定不同的诊断数据目录,请设置diagnosticDataCollectionDirectoryPath
参数。
The following parameters support diagnostic data capture (FTDC):以下参数支持诊断数据捕获(FTDC):
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. 选择诊断数据捕获间隔的默认值和最大大小,以便在对性能和存储大小影响最小的情况下为MongoDB工程师提供有用的数据。Typically, these values will only need modifications as requested by MongoDB engineers for specific diagnostic purposes.通常,这些值只需要根据MongoDB工程师的要求进行修改,以用于特定的诊断目的。
diagnosticDataCollectionEnabled
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Type类型: boolean
Default默认值: true
Determines whether to enable the collecting and logging of data for diagnostic purposes. 确定是否为诊断目的启用数据集合和日志记录。Diagnostic logging is enabled by default.默认情况下启用诊断日志记录。
For example, the following disables the diagnostic collection:例如,以下内容将禁用诊断集合:
mongod --setParameter diagnosticDataCollectionEnabled=false
diagnosticDataCollectionDirectoryPath
Type类型: String
Available for 仅适用于mongos
only.mongos
。
Specify the directory for the diagnostic directory for 指定mongos
. mongos
诊断目录的目录。If the directory does not exist, 如果目录不存在,mongos
creates the directory.mongos
将创建该目录。
If unspecified, the diagnostic data directory is computed by truncating the 如果未指定,则通过截断mongos
instance's --logpath
or systemLog.path
file extension(s) and concatenating diagnostic.data
.mongos
实例的--logpath
或systemLog.path
文件扩展名并连接diagnostic.data
来计算诊断数据目录。
For example, if 例如,如果mongos
has --logpath /var/log/mongodb/mongos.log.201708015
, then the diagnostic data directory is /var/log/mongodb/mongos.diagnostic.data/
.mongos
具有--logpath /var/log/mongodb/mongos.log.201708015
,则诊断数据目录为/var/log/mongodb/mongos.diagnostic.data/
。
If the 如果mongos
cannot create the specified directory, the diagnostic data capture is disabled for that instance. mongos
无法创建指定的目录,那么将禁用该实例的诊断数据捕获。This is often caused by:这通常是由以下原因引起的:
diagnosticDataCollectionDirectorySizeMB
Increased default size to 200 megabytes.将默认大小增加到200 MB。
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Type类型: integer
Default默认值: 200
Specifies the maximum size, in megabytes, of the 指定diagnostic.data
directory. diagnostic.data
目录的最大大小(MB)。If directory size exceeds this number, the oldest diagnostic files in the directory are automatically deleted based on the timestamp in the file name.如果目录大小超过此数字,将根据文件名中的时间戳自动删除目录中最旧的诊断文件。
For example, the following sets the maximum size of the directory to 例如,以下命令将目录的最大大小设置为250
megabytes:250
MB:
mongod --setParameter diagnosticDataCollectionDirectorySizeMB=250
The minimum value for diagnosticDataCollectionDirectorySizeMB
is 10
megabytes. diagnosticDataCollectionDirectorySizeMB
的最小值为10
MB。diagnosticDataCollectionDirectorySizeMB
must be greater than maximum diagnostic file size 必须大于最大诊断文件大小ddiagnosticDataCollectionFileSizeMB
.diagnosticDataCollectionFileSizeMB
。
diagnosticDataCollectionFileSizeMB
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Type类型: integer
Default默认值: 10
Specifies the maximum size, in megabytes, of each diagnostic file. 指定每个诊断文件的最大大小(MB)。If the file exceeds the maximum file size, MongoDB creates a new file.如果文件超过最大文件大小,MongoDB将创建一个新文件。
For example, the following sets the maximum size of each diagnostic file to 例如,下面将每个诊断文件的最大大小设置为20
megabytes:20
MB:
mongod --setParameter diagnosticDataCollectionFileSizeMB=20
The minimum value for diagnosticDataCollectionFileSizeMB
is 1
megabyte.diagnosticDataCollectionFileSizeMB
的最小值为1
MB。
diagnosticDataCollectionPeriodMillis
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Type类型: integer
Default默认值: 1000
Specifies the interval, in milliseconds, at which to collect diagnostic data.指定集合诊断数据的间隔(毫秒)。
For example, the following sets the interval to 例如,以下命令将间隔设置为5000
milliseconds or 5 seconds:5000
毫秒或5秒:
mongod --setParameter diagnosticDataCollectionPeriodMillis=5000
The minimum value for diagnosticDataCollectionPeriodMillis
is 100
milliseconds.diagnosticDataCollectionPeriodMillis
的最小值为100
毫秒。
disableSplitHorizonIPCheck
New in version 5.0.0.在版本5.0.0中新增。
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Type类型: boolean
Default默认值: false
To configure cluster nodes for split horizon DNS, use host names instead of IP addresses.要为拆分范围DNS配置群集节点,请使用主机名而不是IP地址。
Starting in MongoDB v5.0, 从MongoDB v5.0开始,replSetInitiate
and replSetReconfig
reject configurations that use IP addresses instead of hostnames.replSetInitiate
和replSetReconfig
拒绝使用IP地址而不是主机名的配置。
Use 使用disableSplitHorizonIPCheck
to modify nodes that cannot be updated to use host names. disableSplitHorizonIPCheck
修改无法更新为使用主机名的节点。The parameter only applies to the configuration commands.该参数仅适用于配置命令。
mongod
and mongos
do not rely on disableSplitHorizonIPCheck
for validation at startup. mongod
和mongos
在启动时不依赖disableSplitHorizonIPCheck
进行验证。Legacy 使用IP地址而不是主机名的旧mongod
and mongos
instances that use IP addresses instead of host names will start after an upgrade.mongod
和mongos
实例将在升级后启动。
Instances that are configured with IP addresses log a warning to use host names instead of IP addresses.配置了IP地址的实例会记录一条警告,以使用主机名而不是IP地址。
To allow configuration changes using IP addresses, set 要允许使用IP地址更改配置,请使用命令行设置disableSplitHorizonIPCheck=true
using the command line:disableSplitHorizonIPCheck=true
:
/usr/local/bin/mongod --setParameter disableSplitHorizonIPCheck=true -f /etc/mongod.conf
To allow configuration changes using IP addresses, set 要允许使用IP地址更改配置,请使用节点的配置文件将disableSplitHorizonIPCheck=true
using the node's configuration file:disableSplitHorizonIPCheck
设置为true
:
setParameter:
disableSplitHorizonIPCheck: true
If you attempt to update 如果尝试在运行时更新disableSplitHorizonIPCheck
at runtime, db.adminCommand()
returns an error:disableSplitHorizonIPCheck
,db.adminCommand()
将返回一个错误:
db.adminCommand( { setParameter: 1, "disableSplitHorizonIPCheck": true } ) MongoServerError: not allowed to change [disableSplitHorizonIPCheck] at runtime
enableOverrideClusterChainingSetting
New in version 5.0.2.在版本5.0.2中新增。
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Type类型: boolean
Default默认值: false
If 如果enableOverrideClusterChainingSetting
is true
, replica set secondary members can replicate data from other secondary members even if settings.chainingAllowed
is false
.enableOverrideClusterChainingSetting
为true
,则副本集secondary成员可以从其他辅助成员复制数据,即使settings.chainingAllowed
为false
。
You can only set 您只能在启动时设置enableOverrideClusterChainingSetting
at startup and cannot change this setting with the setParameter
command.enableOverrideClusterChainingSetting
,不能使用setParameter
命令更改此设置。
For example, to set the 例如,要将enableOverrideClusterChainingSetting
for a mongod
instance to true
:mongod
实例的enableOverrideClusterChainingSetting
设置为true
:
mongod --setParameter enableOverrideClusterChainingSetting=true
logicalSessionRefreshMillis
New in version 4.0.4 (and version 3.6.9).4.0.4版(和3.6.9版)中的新增功能。
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Type类型: integer
Default默认值: 300000 (5 minutes)
The interval (in milliseconds) at which the cache refreshes its logical session records against the main session store.缓存根据主会话存储刷新其逻辑会话记录的间隔(毫秒)。
You can only set 您只能在启动时设置logicalSessionRefreshMillis
at startup and cannot change this setting with the setParameter
command.logicalSessionRefreshMillis
,不能使用setParameter
命令更改此设置。
For example, to set the 例如,要将logicalSessionRefreshMillis
for a mongod
instance to 10 minutes:mongod
实例的logicalSessionRefreshMillis
设置为10分钟:
mongod --setParameter logicalSessionRefreshMillis=600000
localLogicalSessionTimeoutMinutes
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Type类型: integer
Default默认值: 30
This parameter is intended for testing purposes only and not for production use.此参数仅用于测试目的,不用于生产。
The time in minutes that a session remains active after its most recent use. 会话在最近一次使用后保持活动状态的时间(分钟)。Sessions that have not received a new read/write operation from the client or been refreshed with 未从客户端接收到新读/写操作或使用refreshSessions
within this threshold are cleared from the cache. refreshSessions
刷新的会话在此阈值内的会话将从缓存中清除。State associated with an expired session may be cleaned up by the server at any time.服务器可以随时清除与过期会话相关联的状态。
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.要在副本集和分片群集上设置此参数,必须在每个成员上指定相同的值;否则,会话将无法正常工作。
You can only set 您只能在启动时设置localLogicalSessionTimeoutMinutes
at startup and cannot change this setting with the setParameter
command.localLogicalSessionTimeoutMinutes
,不能使用setParameter
命令更改此设置。
For example, to set the 例如,要将测试localLogicalSessionTimeoutMinutes
for a test mongod
instance to 20 minutes:mongod
实例的localLogicalSessionTimeoutMinutes
设置为20分钟:
mongod --setParameter localLogicalSessionTimeoutMinutes=20
maxAcceptableLogicalClockDriftSecs
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Type类型: integer
Default默认值: 31536000 (1 year)
The maximum amount by which the current cluster time can be advanced; specifically, 当前集群时间可以提前的最大数量;具体来说,maxAcceptableLogicalClockDriftSecs
is the maximum difference between the new value of the cluster time and the current cluster time. maxAcceptableLogicalClockDriftSecs
是集群时间的新值与当前集群时间之间的最大差值。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 如果新群集时间与当前群集时间的差异超过maxAcceptableLogicalClockDriftSecs
.maxAcceptableLogicalClockDriftSecs
,则无法将群集时间提前到新值。
You can only set 您只能在启动时设置maxAcceptableLogicalClockDriftSecs
at startup and cannot change this setting with the setParameter
command.maxAcceptableLogicalClockDriftSecs
,不能使用setParameter
命令更改此设置。
For example, to set the 例如,要将maxAcceptableLogicalClockDriftSecs
for a mongod
instance to 15 minutes:mongod
实例的maxAcceptableLogicalClockDriftSecs
设置为15分钟:
mongod --setParameter maxAcceptableLogicalClockDriftSecs=900
maxSessions
New in version 4.0.1.在版本4.0.1中新增。
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Type类型: integer
Default默认值: 1000000
The maximum number of sessions that can be cached.可以缓存的最大会话数。
You can only set 您只能在启动期间设置maxSessions
during start-up.maxSessions
。
For example, to set the 例如,要将maxSessions
for a mongod
instance to 1000:mongod
实例的maxSessions
设置为1000:
mongod --setParameter maxSessions=1000
storeFindAndModifyImagesInSideCollection
New in version 5.1.在版本5.1中新增。
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Type类型: boolean
Default默认值: true
Determines whether the temporary documents required for retryable 确定可重试findAndModify
commands are stored in the side collection (config.image_collection
).findAndModify
命令所需的临时文档是否存储在侧面集合(config.image_collection
)中。
If 如果storeFindAndModifyImagesInSideCollection
is:storeFindAndModifyImagesInSideCollection
为:
true
, the temporary documents are stored in the side collection.true
,则临时文档存储在side集合中。false
, the temporary documents are stored in the replica set oplog.false
,则临时文档存储在副本集oplog中。Keep 如果出现以下情况,请将storeFindAndModifyImagesInSideCollection
set to true
if you:storeFindAndModifyImagesInSideCollection
设置为true
:
findAndModify
workload.findAndModify
工作负载。findAndModify
commands than is available in the replica set oplog.findAndModify
命令所需的临时文档空间比副本集oplog中的可用空间多。Secondaries may experience increased CPU usage when 当storeFindAndModifyImagesInSideCollection
is true
.storeFindAndModifyImagesInSideCollection
为true
时,Secondaries可能会增加CPU使用量。
For example, to set 例如,要在启动期间将storeFindAndModifyImagesInSideCollection
to false
during startup:storeFindAndModifyImagesInSideCollection
设置为false
:
mongod --setParameter storeFindAndModifyImagesInSideCollection=false
During runtime, you can also set the parameter with the 在运行时,还可以使用setParameter
command:setParameter
命令设置参数:
db.adminCommand( { setParameter: 1, storeFindAndModifyImagesInSideCollection: false } )
TransactionRecordMinimumLifetimeMinutes
Available for 仅适用于mongod
only.mongod
。
Type类型: integer
Default默认值: 30
The minimum lifetime a transaction record exists in the 事务记录在符合清理条件之前存在于transactions
collection before the record becomes eligible for cleanuptransactions
集合中的最短生存期.
You can only set 只能在启动时设置TransactionRecordMinimumLifetimeMinutes
at startup and cannot change this setting with the setParameter
command.TransactionRecordMinimumLifetimeMinutes
,不能使用setParameter
命令更改此设置。
For example, to set the 例如,要将TransactionRecordMinimumLifetimeMinutes
for a mongod
instance to 20 minutes:mongod
实例的TransactionRecordMinimumLifetimeMinutes
设置为20分钟:
mongod --setParameter TransactionRecordMinimumLifetimeMinutes=20
enableFlowControl
New in version 4.2.在版本4.2中新增。
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' 启用或禁用控制主要应用其写入的速率的机制,以将次要成员的多数提交延迟保持在可配置的最大值以下。majority committed
lag under a configurable maximum value.
For flow control to engage, the replica set/sharded cluster must have: featureCompatibilityVersion (FCV) of 要启用流控制,副本集/分片集群必须具有:4.2
and read concern majority enabled
. featureCompatibilityVersion
(FCV)为4.2,并启用读取关注多数。That is, enabled flow control has no effect if FCV is not 也就是说,如果FCV不是4.2
or if read concern majority is disabled.4.2
,或者如果禁用了大多数读取问题,则启用的流量控制无效。
flowControlTargetLagSeconds
New in version 4.2.在版本4.2中新增。
Type类型: integer
Default默认值: 10
The target maximum 使用流量控制运行时的目标最大多数提交延迟。majority committed
lag when running with flow control. When flow control is enabled, the mechanism attempts to keep the 当启用流控制时,该机制会尝试将多数提交延迟保持在指定秒以下。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.指定的值必须大于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.通常,默认设置应足够;然而,如果从默认值进行修改,减少而不是增加,该值可能会更有用。
flowControlWarnThresholdSeconds
New in version 4.2.在版本4.2中新增。
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.指定的值必须大于或等于0,如果为0,则禁用警告。
initialSyncTransientErrorRetryPeriodSeconds
New in version 4.4.在版本4.4中新增。
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.默认值相当于24小时。
initialSyncSourceReadPreference
New in version 4.4.在版本4.4中新增。
Type类型: String
Available for 仅适用于mongod
only.mongod
。
The preferred source for performing initial sync. 执行初始同步的首选源。Specify one of the following read preference modes:指定以下读取首选项模式之一:
primary
primaryPreferred
secondary
secondaryPreferred
nearest
If the replica set has disabled 如果副本集已禁用chaining
, the default initialSyncSourceReadPreference
read preference mode is primary
.chaining
,则默认的initialSyncSourceReadPreference
读取首选项模式为primary
。
You cannot specify a tag set or 不能将标记集或maxStalenessSeconds
to initialSyncSourceReadPreference
.maxStalenesSeconds
指定为initialSyncSourceReadPreference
。
If the 如果mongod
cannot find a sync source based on the specified read preference, it logs an error and restarts the initial sync process. mongod
无法根据指定的读取首选项找到同步源,它将记录错误并重新启动初始同步进程。The 如果mongod
exits with an error if it cannot complete the initial sync process after 10
attempts. mongod
在10
次尝试后无法完成初始同步过程,则会退出并返回错误。For more information on sync source selection, see Initial Sync Source Selection.有关同步源选择的详细信息,请参阅初始同步源选择。
initialSyncSourceReadPreference
takes precedence over the replica set's 选择初始同步源时,优先于复制集的settings.chainingAllowed
setting when selecting an initial sync source. settings.chainingAllowed
设置。After a replica set member successfully completes initial sync, it defers to the value of 在副本集成员成功完成初始同步后,在选择复制同步源时,它会遵循chainingAllowed
when selecting a replication sync source.chainingAllowed
的值。
You can only set this parameter on startup, using either the 只能在启动时使用setParameter
configuration file setting or the --setParameter
command line option.setParameter
配置文件设置或--setParameter
命令行选项设置此参数。
initialSyncMethod
New in version 5.2.在版本5.2中新增。
Available for 仅适用于mongod
only.mongod
。
Type类型: String
Default默认值: logical
Method used for initial sync.用于初始同步的方法。
Set to 设置为logical
to use logical initial sync. logical
以使用逻辑初始同步。Set to 设置为fileCopyBased
to use file copy based initial sync.fileCopyBased
以使用基于文件副本的初始同步。
You can only set this parameter on startup, using either the 只能在启动时使用setParameter
configuration file setting or the --setParameter
command line option.setParameter
配置文件设置或--setParameter
命令行选项设置此参数。
Available only in MongoDB Enterprise.仅在MongoDB Enterprise中可用。
maxNumSyncSourceChangesPerHour
New in version 5.0.在版本5.0中新增。
Type类型: integer
Default默认值: 3
Sync sources are evaluated each time a sync source is updated and each time a node fetches a batch of oplog entries. 每次更新同步源以及每次节点获取一批oplog条目时,都会评估同步源。If there are more than 如果一小时内更改的源超过maxNumSyncSourceChangesPerHour
source changes in an hour, the node temporarily stops re-evaluating that sync source. maxNumSyncSourceChangesPerHour
,则节点会暂时停止重新评估该同步源。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.类似地,如果主节点更改并禁用链接,则节点将更新为从新的主节点同步。
oplogFetcherUsesExhaust
New in version 4.4.在版本4.4中新增。
Available for 仅适用于mongod
only.mongod
。
Type类型: boolean
Default默认值: true
Enables or disables streaming replication. 启用或禁用流复制。Set the value to 将该值设置为true
to enable streaming replication.true
以启用流复制。
Set the value to 将该值设置为false
to disable streaming replication. false
以禁用流复制。If disabled, secondaries fetch batches of oplog entries by issuing a request to their sync from source and waiting for a response. 如果被禁用,辅助设备将通过从源发出同步请求并等待响应来获取一批oplog条目。This requires a network roundtrip for each batch of oplog entries.这需要对每批oplog条目进行网络往返。
You can only set this parameter on startup, using either the 只能在启动时使用setParameter
configuration file setting or the --setParameter
command line option.setParameter
配置文件设置或--setParameter
命令行选项设置此参数。
oplogInitialFindMaxSeconds
Type类型: integer
Default默认值: 60
Available for 仅适用于mongod
only.mongod
。
Maximum time in seconds for a member of a replica set to wait for the 数据同步期间,副本集成员等待find
command to finish during data synchronization.find
命令完成的最长时间(秒)。
replWriterThreadCount
Type类型: integer
Default默认值: 16
Available for 仅适用于mongod
only.mongod
。
Maximum number of threads to use to apply replicated operations in parallel. 用于并行应用复制操作的最大线程数。Values can range from 1 to 256 inclusive. 值的范围可以从1到256(含)。You can only set 只能在启动时设置replWriterThreadCount
at startup and cannot change this setting with the setParameter
command.replWriterThreadCount
,不能使用setParameter
命令更改此设置。
replWriterMinThreadCount
New in version 5.0.在版本5.0中新增。
Type类型: integer
Default默认值: 0
Available for 仅适用于mongod
only.mongod
。
Minimum number of threads to use to apply replicated operations in parallel. 用于并行应用复制操作的最小线程数。Values can range from 0 to 256 inclusive. 值的范围为0到256(包括0和256)。You can only set 只能在启动时设置replWriterMinThreadCount
at startup and cannot change this setting with the setParameter
command.replWriterMinThreadCount
,不能使用setParameter
命令更改此设置。
Parallel application of replication operations uses up to 复制操作的并行应用程序最多使用replWriterThreadCount
threads. replWriterThreadCount
个线程。If 如果使用小于replWriterMinThreadCount
is configured with a value less than replWriterThreadCount
, the thread pool will timeout idle threads until the total count of threads in the thread pool is equal to replWriterMinThreadCount
.replWriterThreadCount
的值配置replWriterMinThreadCount
,则线程池将使空闲线程超时,直到线程池中的线程总数等于replWriterMinThreadCount
。
replWriterMinThreadCount
must be configured with a value that is less than or equal to 必须配置一个小于或等于replWriterThreadCount
.replWriterThreadCount
的值。
rollbackTimeLimitSecs
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.可以回滚的数据的最长保留时间。此参数的负值无效。
Starting in MongoDB 4.2+ and 4.0.13+, 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.从MongoDB 4.2+和4.0.13+开始,如果要回滚实例的oplog结束到公共点(源节点和要回滚节点具有相同数据的最后一点)之后的第一次操作之间的时间超过此值,回滚将失败。
In MongoDB 4.0.0-4.0.12, if the time between the end of the to-be-rolledback instance's oplog and 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.在MongoDB 4.0.0-4.0.12中,如果待回滚实例的oplog结束与公共点(源节点和待回滚节点具有相同数据的最后一点)之间的时间超过此值,回滚将失败。
To effectively have an unlimited rollback period, set the value to 要有效地拥有无限回滚期,请将该值设置为2147483647
which is the maximum value allowed and equivalent to roughly 68 years.2147483647
,这是允许的最大值,大约相当于68年。
New in version 4.0.在版本4.0中新增。
waitForSecondaryBeforeNoopWriteMS
Available for 仅适用于mongod
only.mongod
。
Type类型: integer
Default默认值: 10
The length of time (in milliseconds) that a secondary must wait if the 如果~大于oplog中上次应用的时间,则辅助服务器必须等待的时间长度(毫秒)。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.waitForSecondaryBeforeNoopWriteMS
后,如果afterClusterTime
仍然大于上次应用的时间,则辅助服务器将进行无操作写入,以提前上次应用时间。
The following example sets the 以下示例将waitForSecondaryBeforeNoopWriteMS
to 20 milliseconds:waitForSecondaryBeforeNoopWriteMS
设置为20毫秒:
mongod --setParameter waitForSecondaryBeforeNoopWriteMS=20
During runtime, you can also set the parameter with the 在运行时,还可以使用setParameter
command:setParameter
命令设置参数:
db.adminCommand( { setParameter: 1, waitForSecondaryBeforeNoopWriteMS: 20 } )
createRollbackDataFiles
Available for 仅适用于mongod
only.mongod
。
Type类型: boolean
Default默认值: true
New in version 4.0.在版本4.0中新增。
Flag that determines whether MongoDB creates rollback files that contains documents affected during a rollback.用于确定MongoDB是否创建包含回滚期间受影响文档的回滚文件的标志。
By default, 默认情况下,createRollbackDataFiles
is true
and MongoDB creates the rollback files.createRollbackDataFiles
为true
,MongoDB创建回滚文件。
The following example sets 以下示例将createRollbackDataFiles
to false so that the rollback files are not created:createRollbackDataFiles
设置为false
,以便不创建回滚文件:
mongod --setParameter createRollbackDataFiles=false
During runtime, you can also set the parameter with the 在运行时,还可以使用setParameter
command:setParameter
命令设置参数:
db.adminCommand( { setParameter: 1, createRollbackDataFiles: false } )
For more information, see Collect Rollback Data.有关详细信息,请参阅集合回滚数据。
enableElectionHandoff
New in version 4.0.2.在版本4.0.2中新增。
Type类型: boolean
Default默认值: true
A flag that can reduce the downtime after the primary steps down from either the 一个标志,可以减少从rs.stepDown()
method or the replSetStepDown
command.rs.stepDown()
方法或replSetStepDown
命令执行主步骤后的停机时间。
If the flag is true, when a primary steps down after 如果该标志为rs.stepDown()
(or the replSetStepDown
command without the force: true
), the primary nominates an eligible secondary to call an election immediately.true
,则当一名主要候选人在rs.stepDown()
之后下台(或不使用force:true
的 replSetStepDown
命令)时,主要候选人提名一名合格的次要候选人立即进行选举。
If the flag is false, after the step down, secondaries can wait up to 如果标志为假,则在下台后,secondaries可以等待设置settings.electionTimeoutMillis
before calling an election.settings.electionTimeoutMillis
,然后再进行选举。
An eligible secondary must be caught up with the stepped down primary and have 符合条件的次要成员必须赶上已卸任的主要成员,并且priority
greater than 0. priority
大于0。If multiple secondary members meet this criteria, the stepped down primary selects the eligible secondary with the highest 如果多个次要成员符合此条件,则卸任的次要成员将选择具有最高priority
. priority
的合格次要成员。If the more than one eligible secondary members have the same 如果多个合格的次要成员具有相同的priority
, the stepped down primary selects the secondary with the lowest _id
. priority
,则逐步降级的主要成员将选择具有最低_id
的次要成员。The stepped down primary does not wait for the effects of the handoff.逐步下降的主节点不等待切换的影响。
The parameter has no impact if the primary steps down for reasons other than 如果主程序因rs.stepDown()
(or the replSetStepDown
command without the force: true
).rs.stepDown()
以外的原因(或没有force: true
的replSetStepDown
命令)而退出,则该参数没有影响。
replBatchLimitBytes
Default默认值: 104857600 (100MB)
Sets the maximum oplog application batch size in bytes.设置oplog应用程序的最大批大小(字节)。
Values can range from 16777216 (16MB) to 104857600 (100MB) inclusive.值的范围为16777216(16MB)到104857600(100MB)(含)。
The following example sets 以下示例将replBatchLimitBytes
to 64 MB so that the rollback files are not created:replBatchLimitBytes
设置为64 MB,以便不创建回滚文件:
mongod --setParameter replBatchLimitBytes=67108864
During runtime, you can also set the parameter with the 在运行时,还可以使用setParameter
command:setParameter
命令设置参数:
db.adminCommand( { setParameter: 1, replBatchLimitBytes: 64 * 1024 * 1024 } )
New in version 4.0.10.在版本4.0.10中新增。
mirrorReads
Available for 仅适用于mongod
only.mongod
。
New in version 4.4.在版本4.4中新增。/p>
Type类型: Document
Default默认值: { samplingRate: 0.01, maxTimeMS: 1000 }
Specifies the settings for mirrored reads for the 指定mongod
instance. mongod
实例的镜像读取设置。The settings only take effect when the member is a primary.这些设置仅在成员是主成员时生效。
The parameter 参数mirrorReads
takes a JSON document with the following fields:mirrorReads
采用具有以下字段的JSON文档:
samplingRate |
| ||||||||
maxTimeMS |
|
You can set 您可以在启动期间在配置文件中或使用命令行上的mirrorReads
during startup in the configuration file
or with the --setParameter
option on the command line. configuration file
选项设置mirrorReads
。If specifying from the configuration file or on the command line, enclose the如果从配置文件或命令行中指定,请用引号将mirrorReads
document in quotes.mirrorReads
文档括起来。
For example, the following sets the mirror reads sampling rate to 例如,以下命令从命令行将镜像读取采样率设置为0.10
from the command line:0.10
:
mongod --setParameter mirrorReads='{ samplingRate: 0.10 }'
Or, to specify in a configuration file:或者,要在配置文件中指定:
setParameter: mirrorReads: '{samplingRate: 0.10}'
Or if using the 或者,如果在连接到正在运行的setParameter
command in a mongosh
session that is connected to a running mongod
, do not enclose the document in quotes:mongod
的mongosh
会话中使用setParameter
命令,请不要将文档括在引号中:
db.adminCommand( { setParameter: 1, mirrorReads: { samplingRate: 0.10 } } )
Starting in version 4.2, MongoDB removes the parameter 从4.2版开始,MongoDB删除参数AsyncRequestsSenderUseBaton
and always enables the performance enhancement controlled by the parameter.AsyncRequestsSenderUseBaton
,并始终启用由该参数控制的性能增强。
chunkDefragmentationThrottlingMS
New in version 5.3.在版本5.3中新增。
Type类型: integer
Default默认值: 0
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Specifies the minimum time period (in milliseconds) between consecutive split and merge commands run by the balancer when the chunks in a sharded collection are defragmented. 指定分片集合中的块进行分片整理时,平衡器运行的连续拆分和合并命令之间的最短时间段(以毫秒为单位)。chunkDefragmentationThrottlingMS
limits the rate of split and merge commands.限制拆分和合并命令的速率。
The following example sets 以下示例将chunkDefragmentationThrottlingMS
to 10
milliseconds:chunkDefragmentationThrottlingMS
设置为10
毫秒:
mongod --setParameter chunkDefragmentationThrottlingMS=10
During runtime, you can also set the parameter with the 在运行时,还可以使用setParameter
command:setParameter
命令设置参数:
db.adminCommand( { setParameter: 1, chunkDefragmentationThrottlingMS: 10 } )
disableResumableRangeDeleter
New in version 4.4.在版本4.4中新增。
Type类型: boolean
Default默认值: false
Available for 仅适用于mongod
only.mongod
。
If set on a shard's primary, specifies if range deletion is paused on the shard. 如果在分片的主分片上设置,则指定是否在分片上暂停范围删除。If set to 如果设置为true
, cleanup of chunk`ranges containing :term:`orphaned documents is paused. true
,则将暂停清理chunk`ranges containing :term:`orphaned documents。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
. 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 该分片可以继续从其他分片接收块,只要它在config.rangeDeletions
collection that overlaps with the incoming chunk's range.config.rangeDeletions
集合中没有与传入块的范围重叠的挂起范围删除任务。
When 当disableResumableRangeDeleter
is true
, chunk migrations fail if orphaned documents exist on the recipient shard's primary in the same range as the incoming chunks.disableResumableRangeDeleter
为true
时,如果接收方分片的主分片上存在孤立文档,且该文档与传入块的范围相同,则块迁移失败。
The parameter has no effect on the 如果该参数不是分片的主参数,则该参数对mongod
if it is not the shard's primary.mongod
没有影响。
If you set 如果将disableResumableRangeDeleter
parameter to true
, ensure that you apply it consistently for all members in the shard's replica set. disableResumableRangeDeleter
参数设置为true
,请确保将其一致地应用于分片副本集中的所有成员。In the event of a failover, this setting's value on the new primary dictates the behavior of the range deleter.在发生故障转移时,新主服务器上的此设置值决定范围删除程序的行为。
You can only set this parameter during start-up and cannot change this setting using the 您只能在启动期间设置此参数,不能使用setParameter
database command.setParameter
数据库命令更改此设置。
mongod --setParameter disableResumableRangeDeleter=false
enableShardedIndexConsistencyCheck
New in version 4.4 (and 4.2.6).4.4版(和4.2.6版)新增。
Type类型: boolean
Default默认值: true
Available for 仅适用于mongod
only.mongod
。
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 如果mongod
if it is not the config server's primary.mongod
不是配置服务器的主参数,则该参数对mongod
没有影响。
The following example sets 以下示例将配置服务器主服务器的enableShardedIndexConsistencyCheck
to false
for a config server primary:enableShardedIndexConsistencyCheck
设置为false
:
mongod --setParameter enableShardedIndexConsistencyCheck=false
During runtime, you can also set the parameter with the 在运行时,还可以使用setParameter
command:setParameter
命令设置参数:
db.adminCommand( { setParameter: 1, enableShardedIndexConsistencyCheck: false } )
shardedIndexConsistencyCheckIntervalMS
shardedIndexConsistency
metrics returned by the serverStatus
command.serverStatus
命令返回的shardedIndexConsistency
度量。shardedIndexConsistencyCheckIntervalMS
New in version 4.4 (and 4.2.6).4.4版(和4.2.6版)新增。
Type类型: integer
Default默认值: 600000
Available for 仅适用于mongod
only.mongod
。
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 如果mongod
if it is not the config server's primary.mongod
不是配置服务器的主参数,则该参数对mongod
没有影响。
You can only set the parameter during startup, and cannot change this setting using the 只能在启动期间设置参数,不能使用setParameter
database command.setParameter
数据库命令更改此设置。
For example, the following sets the interval at 300000 milliseconds (5 minutes) at startup:例如,以下内容将启动时的间隔设置为300000毫秒(5分钟):
mongod --setParameter shardedIndexConsistencyCheckIntervalMS=300000
enableShardedIndexConsistencyCheck
parametershardedIndexConsistency
metrics returned by the serverStatus
commandqenableFinerGrainedCatalogCacheRefresh
New in version 4.4.在版本4.4中新增。
Type类型: boolean
Default默认值: true
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
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 routers who contact the shard to refresh their shard catalog cache.如果禁用,任何过时的块将导致集合的整个块分布被视为过时,并强制所有与分片联系的路由器刷新其分片目录缓存。
You can only set this parameter during start-up and cannot change this setting using the 您只能在启动期间设置此参数,不能使用setParameter
database command.setParameter
数据库命令更改此设置。
mongod --setParameter enableFinerGrainedCatalogCacheRefresh=true mongos --setParameter enableFinerGrainedCatalogCacheRefresh=true
maxTimeMSForHedgedReads
New in version 4.4.在版本4.4中新增。
Type类型: integer
Default默认值: 150
Available for 仅适用于mongos
only.mongos
。
Specifies the maximimum time limit (in milliseconds) for the hedged read. 指定对冲读取的最大时间限制(毫秒)。That is, the additional read sent to hedge the read operation uses the 也就是说,发送给对冲读取操作的附加读取使用maxTimeMS
value of maxTimeMSForHedgedReads
while the read operation that is being hedged uses the maxTimeMS
value specified for the operation.maxTimeMSForHedgedReads
的maxTimeMS
值,而对冲的读取操作使用为操作指定的maxTimeMS
值。
For example, to set the limit to 200 milliseconds, you can issue the following during startup:例如,要将限制设置为200毫秒,可以在启动期间发出以下命令:
mongos --setParameter maxTimeMSForHedgedReads=200
Or if using the 或者,如果在连接到正在运行的setParameter
command in a mongosh
session that is connected to a running mongos
:mongos
的mongosh
会话中使用setParameter
命令:
db.adminCommand( { setParameter: 1, maxTimeMSForHedgedReads: 200 } )
maxCatchUpPercentageBeforeBlockingWrites
New in version 5.0.在版本5.0中新增。 (Also available starting in 4.4.7, 4.2.15, 4.0.26)
Type类型: integer
Default默认值: 10
Available for 仅适用于mongod
only.mongod
。
For 对于moveChunk
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.moveChunk
操作,指定迁移协议允许从catchup
阶段转换到commit
阶段的未传输数据的最大百分比(以总块大小的百分比表示)。
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 设置更高的追赶百分比可以减少迁移完成所需的时间,但代价是在并发upsert
and delete
operations.upsert
和delete
操作期间增加延迟。
For example, to set the maximum percentage to 20, you can issue the followingduring startup:例如,要将最大百分比设置为20,可以在启动期间发出以下命令:
mongod --setParameter maxCatchUpPercentageBeforeBlockingWrites=20
You cannot change 无法在运行时更改maxCatchUpPercentageBeforeBlockingWrites
during runtime.maxCatchUpPercentageBeforeBlockingWrites
。
metadataRefreshInTransactionMaxWaitBehindCritSecMS
New in version 5.2.在版本5.2中新增。 (Also available starting in 5.1.0, 5.0.4也可从5.1.0、5.0.4开始提供)
Type类型: integer
Default默认值: 500
Available for 仅适用于mongod
only.mongod
。
Limits the time a shard waits for a critical section within a transaction.限制分片等待事务中关键部分的时间。
When a query accesses a shard, a chunk migration or DDL operation may already hold the critical section for the collection. 当查询访问分片时,块迁移或DDL操作可能已经保存了集合的关键部分。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 如果查询发现关键部分被占用,则分片将等待直到关键部分被释放。当shard将控制权返回给mongos
, mongos
retries the query. mongos
时,mongos
会重试查询。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.但是,如果多分片事务与在多个分片上获取关键部分的操作交互,则交互可能会导致分布式死锁。
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 the value of 要减少事务中关键部分的最大等待时间,请降低metadataRefreshInTransactionMaxWaitBehindCritSecMS
.metadataRefreshInTransactionMaxWaitBehindCritSecMS
的值。
If 如果metadataRefreshInTransactionMaxWaitBehindCritSecMS
is too low, mongos
could use all of its retry attempts and return an error.metadataRefreshInTransactionMaxWaitBehindCritSecMS
太低,mongos
可能会使用其所有重试尝试并返回错误。
You can set 您可以在启动时和运行时设置metadataRefreshInTransactionMaxWaitBehindCritSecMS
at startup and during runtime.metadataRefreshInTransactionMaxWaitBehindCritSecMS
。
For example, to set 例如,要将metadataRefreshInTransactionMaxWaitBehindCritSecMS
to 400 milliseconds:metadataRefreshInTransactionMaxWaitBehindCritSecMS
设置为400毫秒:
db.adminCommand( { setParameter: 1, metadataRefreshInTransactionMaxWaitBehindCritSecMS: 400 } )
readHedgingMode
New in version 4.4.在版本4.4中新增。
Type类型: string
Default默认值: on
Available for 仅适用于mongos
only.mongos
。
Specifies whether 指定mongos
supports hedged reads for those read operations whose read preference have enabled the hedged read option.mongos
是否支持那些读取首选项已启用对冲读取选项的读取操作的对冲读取。
Available values are:可用值包括:
on | mongos instance supports hedged reads for read operations whose read preference have enabled the hedged read option.mongos 实例支持对其读取首选项启用了对冲读取选项的读取操作进行对冲读取。
|
off | mongos instance does not support hedged reads. mongos 实例不支持对冲读取。 |
For example, to turn off hedged read support for a 例如,要关闭mongos
instance, you can issue the following during startup:mongos
实例的对冲读取支持,可以在启动期间发出以下命令:
mongos --setParameter readHedgingMode=off
Or if using the 或者,如果在连接到正在运行的setParameter
command in a mongosh
session that is connected to a running mongos
:mongos
的mongosh
会话中使用setParameter
命令:
db.adminCommand( { setParameter: 1, readHedgingMode: "off" } )
shutdownTimeoutMillisForSignaledShutdown
New in version 5.0.在版本5.0中新增。
Type类型: integer
Default默认值: 15000
Available for 仅适用于mongod
only.mongod
。
Specifies the time (in milliseconds) to wait for any ongoing database operations to complete before initiating a shutdown of 指定在响应mongod
in response to a SIGTERM
signal.SIGTERM
信号启动mongod
关闭之前等待任何正在进行的数据库操作完成的时间(毫秒)。
For example, to set the time to 250 milliseconds, you can issue the following during startup:例如,要将时间设置为250毫秒,可以在启动期间发出以下命令:
mongod --setParameter shutdownTimeoutMillisForSignaledShutdown=250
Or if using the 或者,如果在连接到正在运行的setParameter
command in a mongosh
session that is connected to a running mongod
:mongod
的mongosh
会话中使用setParameter
命令:
db.adminCommand( { setParameter: 1, shutdownTimeoutMillisForSignaledShutdown: 250 } )
mongosShutdownTimeoutMillisForSignaledShutdown
New in version 5.0.在版本5.0中新增。
Type类型: integer
Default默认值: 15000
Available for 仅适用于mongos
only.mongos
。
Specifies the time (in milliseconds) to wait for any ongoing database operations to complete before initiating a shutdown of 指定在响应mongos
in response to a SIGTERM
signal.SIGTERM
信号启动mongos
关闭之前等待任何正在进行的数据库操作完成的时间(毫秒)。
For example, to set the time to 250 milliseconds, you can issue the following during startup:例如,要将时间设置为250毫秒,可以在启动期间发出以下命令:
mongos --setParameter mongosShutdownTimeoutMillisForSignaledShutdown=250
Or if using the 或者,如果在连接到正在运行的setParameter
command in a mongosh
session that is connected to a running mongos
:mongos
的mongosh
会话中使用setParameter
命令:
db.adminCommand( { setParameter: 1, mongosShutdownTimeoutMillisForSignaledShutdown: 250 } )
replMonitorMaxFailedChecks
Available in MongoDB 3.2 only仅在MongoDB 3.2中可用
Type: integer
Default: 30
The number of times the mongod
or mongos
instance tries to reach the replica sets in the sharded cluster (for example, shard replica sets, config server replica set) to monitor the replica set status and topology.mongod
或mongos
实例尝试访问分片集群中的副本集(例如,分片副本集、配置服务器副本集)以监视副本集状态和拓扑的次数。
When the number of consecutive unsuccessful attempts exceeds this parameter value, the 当连续失败的尝试次数超过此参数值时,mongod
or mongos
instance denotes the monitored replica set as unavailable. mongod
或mongos
实例表示受监视的副本集不可用。If the monitored replica set is the config server replica set:如果受监视的副本集是配置服务器副本集:
mongod
or mongos
instance will become unusable and needs to be restarted. mongod
或mongos
实例将变得不可用,需要重新启动。timeOutMonitoringReplicaSets
.timeOutMonitoringReplicaSets
。timeOutMonitoringReplicaSets
Available in MongoDB 3.2.10 and later 3.2-series only仅在MongoDB 3.2.10和更高版本的3.2系列中提供
Type: integer
Default: false
The flag that determines whether the 用于确定mongod
or mongos
instance should stop its attempt to reach the monitored replica set after unsuccessfully trying replMonitorMaxFailedChecks
number of times.mongod
或mongos
实例在尝试replMonitorMaxFailedChecks
失败后是否应停止尝试访问受监视的副本集的标志。
If the monitored replica set is the config server replica set and 如果被监视的副本集是配置服务器副本集,并且timeOutMonitoringReplicaSets
is set to true
, you must restart mongod
or mongos
if the mongod
or mongos
instance cannot reach any of the config servers for the specified number of times. timeOutMonitoringReplicaSets
设置为true
,那么如果mongod
或mongos
实例在指定次数内无法访问任何配置服务器,则必须重新启动mongod
和mongos
。See the v3.2 troubleshooting guide for more details.有关详细信息,请参阅v3.2故障排除指南。
ShardingTaskExecutorPoolHostTimeoutMS
Type: integer
Default: 300000 (5 minutes)
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Maximum time that 在mongos
goes without communication to a host before mongos
drops all connections to the host.mongos
断开与主机的所有连接之前,mongos
不与主机通信的最长时间。
If set, 如果设置,ShardingTaskExecutorPoolHostTimeoutMS
should be greater than the sum of ShardingTaskExecutorPoolRefreshRequirementMS
and ShardingTaskExecutorPoolRefreshTimeoutMS
. ShardingTaskExecutorPoolHostTimeoutMS
应大于ShardingTaskExecutorPoolRefreshRequirementMS
和ShardingTaskExecutorPoolRefreshTimeoutMS
之和。Otherwise, 否则,mongos
adjusts the value of ShardingTaskExecutorPoolHostTimeoutMS
to be greater than the sum.mongos
将ShardingTaskExecutorPoolHostTimeoutMS
的值调整为大于总和。
The following example sets 以下示例在启动期间将ShardingTaskExecutorPoolHostTimeoutMS
to 120000
during startup:ShardingTaskExecutorPoolHostTimeoutMS
设置为120000
:
mongos --setParameter ShardingTaskExecutorPoolHostTimeoutMS=120000
During runtime, you can also set the parameter with the 在运行时,还可以使用setParameter
command:setParameter
命令设置参数:
db.adminCommand( { setParameter: 1, ShardingTaskExecutorPoolHostTimeoutMS: 120000 } )
ShardingTaskExecutorPoolMaxConnecting
Type: integer
Default: 2
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Maximum number of simultaneous initiating connections (including pending connections in setup/refresh state) each TaskExecutor connection pool can have to a 每个TaskExecutor连接池可以同时启动mongod
instance. mongod
实例的最大连接数(包括处于设置/刷新状态的挂起连接)。You can set this parameter to control the rate at which 您可以设置此参数来控制mongos
adds connections to a mongod
instance.mongos
向mongod
实例添加连接的速率。
If set, 如果已设置,ShardingTaskExecutorPoolMaxConnecting
should be less than or equal to ShardingTaskExecutorPoolMaxSize
. ShardingTaskExecutorPoolMaxConnecting
应小于或等于ShardingTaskExecutorPoolMaxSize
。If it is greater, 如果大于此值,mongos
ignores the ShardingTaskExecutorPoolMaxConnecting
value.mongos
将忽略ShardingTaskExecutorPoolMaxConnecting
值。
The following example sets 以下示例在启动期间将ShardingTaskExecutorPoolMaxConnecting
to 20
during startup:ShardingTaskExecutorPoolMaxConnecting
设置为20
:
mongos --setParameter ShardingTaskExecutorPoolMaxConnecting=20
During runtime, you can also set the parameter with the 在运行时,还可以使用setParameter
command:setParameter
命令设置参数:
db.adminCommand( { setParameter: 1, ShardingTaskExecutorPoolMaxConnecting: 20 } )
ShardingTaskExecutorPoolMaxSize
Type: integer
Default: 2 64 - 1
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Maximum number of outbound connections each TaskExecutor connection pool can open to any given 每个TaskExecutor连接池可以打开到任何给定mongod
instance. mongod
实例的最大出站连接数。The maximum possible connections to any given host across all TaskExecutor pools is:所有TaskExecutor池中与任何给定主机的最大可能连接数为:
ShardingTaskExecutorPoolMaxSize * taskExecutorPoolSize
The following example sets 以下示例在启动期间将ShardingTaskExecutorPoolMaxSize
to 20
during startup:ShardingTaskExecutorPoolMaxSize
设置为20
:
mongos --setParameter ShardingTaskExecutorPoolMaxSize=20
During runtime, you can also set the parameter with the 在运行时,还可以使用setParameter
command:setParameter
命令设置参数:
db.adminCommand( { setParameter: 1, ShardingTaskExecutorPoolMaxSize: 20 } )
mongos
can have up to 最多可以有n
TaskExecutor connection pools, where n
is the number of cores. n
个TaskExecutor连接池,其中n
是核心数。See 请参阅taskExecutorPoolSize
.taskExecutorPoolSize
。
ShardingTaskExecutorPoolMinSize
Type: integer
Default: 1
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Minimum number of outbound connections each TaskExecutor connection pool can open to any given 每个TaskExecutor连接池可以打开到任何给定mongod
instance.mongod
实例的最小出站连接数。
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 当池处于空闲状态时,池将保持此连接数,直到ShardingTaskExecutorPoolHostTimeoutMS
milliseconds pass without any application using that pool.ShardingTaskExecutorPoolHostTimeoutMS
毫秒过去,没有任何应用程序使用该池为止。
For a 对于使用mongos
using the warmMinConnectionsInShardingTaskExecutorPoolOnStartup
parameter, the ShardingTaskExecutorPoolMinSize
parameter also controls how many connections to each shard host are established on startup of the mongos
instance before it begins accepting incoming client connections.warmMinConnectionsInShardingTaskExecutorPoolOnStartup
参数的mongos
,ShardingTaskExecutorPoolMinSize
参数还控制在mongos
实例开始接受传入客户端连接之前,在启动mongos
时建立到每个分片主机的连接数。
In MongoDB 4.4, the 在MongoDB 4.4中,默认情况下为warmMinConnectionsInShardingTaskExecutorPoolOnStartup
parameter is enabled by default for the mongos
.mongos
启用warmMinConnectionsInShardingTaskExecutorPoolOnStartup
参数。
The following example sets 以下示例在启动期间将ShardingTaskExecutorPoolMinSize
to 2
during startup:ShardingTaskExecutorPoolMinSize
设置为2
:
mongos --setParameter ShardingTaskExecutorPoolMinSize=2
During runtime, you can also set the parameter with the 在运行时,还可以使用setParameter
command:setParameter
命令设置参数:
db.adminCommand( { setParameter: 1, ShardingTaskExecutorPoolMinSize: 2 } )
mongos
can have up to n
TaskExecutor connection pools, where n
is the number of cores. mongos
最多可以有n
个TaskExecutor连接池,其中n
是核心数。See 请参见taskExecutorPoolSize
.taskExecutorPoolSize
。
ShardingTaskExecutorPoolRefreshRequirementMS
Type: integer
Default: 60000 (1 minute)
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Maximum time the mongos
waits before attempting to heartbeat a resting connection in the pool.mongos
在尝试检测池中静止连接之前等待的最长时间。
If set, 如果设置,ShardingTaskExecutorPoolRefreshRequirementMS
should be greater than ShardingTaskExecutorPoolRefreshTimeoutMS
. ShardingTaskExecutorPoolRefreshRequirementMS
应大于ShardingTaskExecutorPoolRefreshTimeoutMS
。Otherwise, 否则,mongos
adjusts the value of ShardingTaskExecutorPoolRefreshTimeoutMS
to be less than ShardingTaskExecutorPoolRefreshRequirementMS
.mongos
会将ShardingTaskExecutorPoolRefreshTimeoutMS
的值调整为小于ShardingTaskExecutorPoolRefreshRequirementMS
。
The following example sets 以下示例在启动期间将ShardingTaskExecutorPoolRefreshRequirementMS
to 90000
during startup:ShardingTaskExecutorPoolRefreshRequirementMS
设置为90000
:
mongos --setParameter ShardingTaskExecutorPoolRefreshRequirementMS=90000
During runtime, you can also set the parameter with the 在运行时,还可以使用setParameter
command:setParameter
命令设置参数:
db.adminCommand( { setParameter: 1, ShardingTaskExecutorPoolRefreshRequirementMS: 90000 } )
ShardingTaskExecutorPoolRefreshTimeoutMS
Type: integer
Default: 20000 (20 seconds)
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Maximum time the mongos
waits for a heartbeat before timing out the heartbeat.mongos
在心跳超时之前等待心跳的最长时间。
If set, 如果设置,ShardingTaskExecutorPoolRefreshTimeoutMS
should be less than ShardingTaskExecutorPoolRefreshRequirementMS
. ShardingTaskExecutorPoolRefreshTimeoutMS
应小于ShardingTaskExecutorPoolRefreshRequirementMS
。Otherwise, 否则,mongos
adjusts the value of ShardingTaskExecutorPoolRefreshTimeoutMS
to be less than ShardingTaskExecutorPoolRefreshRequirementMS
.mongos
会将ShardingTaskExecutorPoolRefreshTimeoutMS
的值调整为小于ShardingTaskExecutorPoolRefreshRequirementMS
。
The following example sets 以下示例在启动期间将ShardingTaskExecutorPoolRefreshTimeoutMS
to 30000
during startup:ShardingTaskExecutorPoolRefreshTimeoutMS
设置为30000
:
mongos --setParameter ShardingTaskExecutorPoolRefreshTimeoutMS=30000
During runtime, you can also set the parameter with the 在运行时,还可以使用setParameter
command:setParameter
命令设置参数:
db.adminCommand( { setParameter: 1, ShardingTaskExecutorPoolRefreshTimeoutMS: 30000 } )
ShardingTaskExecutorPoolReplicaSetMatching
New in version 4.2.在版本4.2中新增。
Changed in version 5.0.在版本5.0中更改。
Type: string
Default: "automatic"
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
On a 在mongos
instance, this parameter sets the policy that determines the minimum size limit of its connection pools to nodes within replica sets.mongos
实例上,此参数设置用于确定其连接池到副本集中节点的最小大小限制的策略。
On a 在mongod
instance, this parameter sets the policy that determines the minimum size limit of its connection pools to nodes within other replica sets.mongod
实例上,此参数设置用于确定其连接池到其他副本集中节点的最小大小限制的策略。
Note that this parameter only manages connections for operations that are directly related to user requests and CRUD operations.请注意,此参数仅管理与用户请求和CRUD操作直接相关的操作的连接。
Available values are:可用值包括:
Matching Policy | |
---|---|
"automatic" (Default) |
|
"matchPrimaryNode" |
|
"matchBusiestNode" |
|
"disabled" |
|
The following example sets the 以下示例在启动期间将ShardingTaskExecutorPoolReplicaSetMatching
to "automatic"
during startup:ShardingTaskExecutorPoolReplicaSetMatching
设置为"automatic"
:
mongod --setParameter ShardingTaskExecutorPoolReplicaSetMatching="automatic"
During runtime, you can also set the parameter with the 在运行时,还可以使用setParameter
command:setParameter
命令设置参数:
db.adminCommand( { setParameter: 1, ShardingTaskExecutorPoolReplicaSetMatching: "automatic" } )
taskExecutorPoolSize
Changed in version 4.0.在版本4.0中更改。
Type: integer
Default: 1
Available for 仅适用于mongos
only.mongos
。
The number of Task Executor connection pools to use for a given 用于给定mongos
.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:0
或更小,则Task Executor连接池的数量是核心的数量,但以下情况除外:
Starting in MongoDB 4.0, the default value of 从MongoDB 4.0开始,taskExecutorPoolSize
is 1
:taskExecutorPoolSize
的默认值为1
:
taskExecutorPoolSize
to 0
and, on Linux, set AsyncRequestsSenderUseBaton to false
for the previous behavior.taskExecutorPoolSize
设置为0
,在Linux上,将AsyncRequestsSenderUseBaton
设置为false
,以实现先前的行为。AsyncRequestsSenderUseBaton
parameter and always enables the performance enhancement controlled by the parameter.AsyncRequestsSenderUseBaton
参数,并始终启用由该参数控制的性能增强。You can only set this parameter during start-up and cannot change this setting using the 您只能在启动期间设置此参数,不能使用setParameter
database command.setParameter
数据库命令更改此设置。
mongos --setParameter taskExecutorPoolSize=6
loadRoutingTableOnStartup
New in version 4.4.在版本4.4中新增。
Type: boolean
Default默认值: true
Available for 仅适用于mongos
only.mongos
。
Configures a 配置mongos
instance to preload the routing table for a sharded cluster on startup. mongos
实例以在启动时为分片集群预加载路由表。With this setting enabled, the 启用此设置后,mongos
caches the cluster-wide routing table for each sharded collection as part of its startup procedure, before it begins accepting client connections.mongos
在开始接受客户端连接之前,会为每个分片集合缓存集群范围的路由表,作为其启动过程的一部分。
Without this setting enabled, the 如果未启用此设置,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.mongos
将只加载传入客户端连接所需的路由表,并且只加载给定请求的名称空间的特定路由表。
A 启用了mongos
instance with the loadRoutingTableOnStartup
parameter enabled may experience longer startup times, but will result in faster servicing of initial client connections once started.loadRoutingTableOnStartup
参数的mongos
实例可能会经历更长的启动时间,但启动后会更快地为初始客户端连接提供服务。
loadRoutingTableOnStartup
is enabled by default.默认情况下启用。
You can only set this parameter on startup, using either the 您只能在启动时使用setParameter
configuration file setting or the --setParameter
command line option.setParameter
配置文件设置或--setParameter
命令行选项设置此参数。
warmMinConnectionsInShardingTaskExecutorPoolOnStartup
New in version 4.4.在版本4.4中新增。
Type: boolean
Default默认值: true
Available for 仅适用于mongos
only.mongos
。
Configures a 配置mongos
instance to prewarm its connection pool on startup. mongos
实例以在启动时预热其连接池。With this parameter enabled, the 启用此参数后,mongos
attempts to establish ShardingTaskExecutorPoolMinSize
network connections to each shard server as part of its startup procedure, before it begins accepting client connections.mongos
会在开始接受客户端连接之前,尝试建立到每个分片服务器的ShardingTaskExecutorPoolMinSize
网络连接,作为其启动过程的一部分。
A timeout for this behavior can be configured with the 可以使用warmMinConnectionsInShardingTaskExecutorPoolOnStartupWaitMS
parameter. warmMinConnectionsInShardingTaskExecutorPoolOnStartupWaitMS
参数配置此行为的超时。If this timeout is reached, the 如果达到此超时,mongos
will begin accepting client connections regardless of the size of its connection pool.mongos
将开始接受客户端连接,而不管其连接池的大小。
A 启用此参数的mongos
instance with this parameter enabled may experience longer startup times, but will result in faster servicing of initial client connections once started.mongos
实例可能会经历更长的启动时间,但一旦启动,将更快地为初始客户端连接提供服务。
warmMinConnectionsInShardingTaskExecutorPoolOnStartup
is enabled by default.默认情况下启用。
You can only set this parameter on startup, using either the 只能在启动时使用setParameter
configuration file setting or the --setParameter
command line option.setParameter
配置文件设置或--setParameter
命令行选项设置此参数。
warmMinConnectionsInShardingTaskExecutorPoolOnStartupWaitMS
New in version 4.4.在版本4.4中新增。
Type: integer
Default默认值: 2000 (2 seconds)
Available for 仅适用于mongos
only.mongos
。
Sets the timeout threshold in milliseconds for a 设置当使用mongos
to wait for ShardingTaskExecutorPoolMinSize
connections to be established per shard host when using the warmMinConnectionsInShardingTaskExecutorPoolOnStartup
parameter. warmMinConnectionsInShardingTaskExecutorPoolOnStartup
参数时,mongos
等待为每个分片主机建立ShardingTaskExecutorPoolMinSize
连接的超时阈值(以毫秒为单位)。If this timeout is reached, the 如果达到此超时,mongos
will begin accepting client connections regardless of the size of its connection pool.mongos
将开始接受客户端连接,而不管其连接池的大小。
You can only set this parameter on startup, using either the 只能在启动时使用setParameter
configuration file setting or the --setParameter
command line option.setParameter
配置文件设置或--setParameter
命令行选项设置此参数。
migrateCloneInsertionBatchDelayMS
New in version 4.0.5.在版本4.0.5中新增。 The parameter is also available starting in 3.4.18 and 3.6.10参数也可从3.4.18和3.6.10开始使用
Available for 仅适用于mongod
only.mongod
。
Type: Non-negative integer类型:非负整数
Default: 0默认值: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
.secondaryThrottle
的补充。
The default value of 默认值0
indicates no additional wait.0
表示无额外等待。
The following sets the 以下内容将migrateCloneInsertionBatchDelayMS
to 200 milliseconds:migrateCloneInsertionBatchDelayMS
设置为200毫秒:
mongod --setParameter migrateCloneInsertionBatchDelayMS=200
The parameter may also be set using the 也可以使用setParameter
command:setParameter
setParameter
命令设置参数:
db.adminCommand( { setParameter: 1, migrateCloneInsertionBatchDelayMS: 200 } )
migrateCloneInsertionBatchSize
New in version 4.0.5.在版本4.0.5中新增。 The parameter is also available starting in 3.4.18 and 3.6.10参数也可从3.4.18和3.6.10开始使用
Available for 仅适用于mongod
only.mongod
。
Type: Non-negative integer类型:非负整数
Default: 0默认值: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. 0
表示每个批次没有最大文档数。However, in practice, this results in batches that contain up to 16 MB of documents.然而,在实践中,这会导致批处理中包含多达16 MB的文档。
The following sets the 以下内容将migrateCloneInsertionBatchSize
to 100 documents:migrateCloneInsertionBatchSize
设置为100个文档:
mongod --setParameter migrateCloneInsertionBatchSize=100
The parameter may also be set using the 也可以使用setParameter
command:setParameter
命令设置参数:
db.adminCommand( { setParameter: 1, migrateCloneInsertionBatchSize: 100 } )
orphanCleanupDelaySecs
Default: 900 (15 minutes)默认值:900(15分钟)
Available for 仅适用于mongod
only.mongod
。
Minimum delay before a migrated chunk is deleted from the source shard.从源分片中删除迁移的块之前的最小延迟。
Before deleting the chunk during chunk migration, MongoDB waits for 在块迁移期间删除块之前,MongoDB会等待orphanCleanupDelaySecs
or for in-progress queries involving the chunk to complete on the shard primary, whichever is longer.orphanCleanupDelaySecs
或正在进行的涉及块的查询在主分片上完成,以时间较长的为准。
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 但是,由于分片主节点不知道在分片次节点上运行的正在进行的查询,如果这些查询花费的时间超过完成分片主节点查询和orphanCleanupDelaySecs
.orphanCleanupDelaySecs
的时间,则使用区块但在次节点上运行的查询可能会看到文档消失。
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.如果在分片辅助设备上运行超过15分钟的查询,请考虑增加此值。
The following sets the 以下内容将orphanCleanupDelaySecs
to 20 minutes:orphanCleanupDelaySecs
设置为20分钟:
mongod --setParameter orphanCleanupDelaySecs=1200
This may also be set using the 也可以使用setParameter
command:setParameter
命令进行设置:
db.adminCommand( { setParameter: 1, orphanCleanupDelaySecs: 1200 } )
rangeDeleterBatchDelayMS
New in version 4.0.1.在版本4.0.1中新增。 The parameter is also available starting in 3.4.17 and 3.6.7.从3.4.17和3.6.7开始,该参数也可用。
Available for 仅适用于mongod
only.mongod
。
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 chunk migration (or the 在块迁移的清理阶段(或cleanupOrphaned
command).cleanupOrphaned
命令),下一批删除之前等待的时间(毫秒)。
In MongoDB 3.4, consider whether _secondaryThrottle is set before modifying the 在MongoDB 3.4中,在修改rangeDeleterBatchDelayMS
. rangeDeleterBatchDelayMS
之前,请考虑是否设置了_secondaryThrottle
。In MongoDB 3.4, the _secondaryThrottle replication delay occurs after each document deletion instead of after the batch deletion.在MongoDB 3.4中,_secondaryThrottle
复制延迟发生在每次文档删除之后,而不是在批量删除之后。
In MongoDB 3.6+, the _secondaryThrottle replication delay occurs after each batch deletion.在MongoDB 3.6+中,_secondaryThrottle
复制延迟发生在每次批量删除之后。
The following sets the 以下内容将rangeDeleterBatchDelayMS
to 200 milliseconds:rangeDeleterBatchDelayMS
设置为200毫秒:
mongod --setParameter rangeDeleterBatchDelayMS=200
The parameter may also be set using the 也可以使用setParameter
command:setParameter
命令设置参数:
db.adminCommand( { setParameter: 1, rangeDeleterBatchDelayMS: 200 } )
rangeDeleterBatchSize
New in version 4.0.5.在版本4.0.5中新增。
Available for 仅适用于mongod
only.mongod
。
Type: Non-negative integer
Default: 2147483647 starting in MongoDB 5.1.2, 5.0.6, and 4.4.12 (128 in earlier MongoDB versions)默认值:从MongoDB 5.1.2、5.0.6和4.4.12开始的2147483647(早期MongoDB版本中为128)
The maximum number of documents in each batch to delete during the cleanup stage of chunk migration(or the 在区块迁移的清理阶段(或cleanupOrphaned
command).cleanupOrphaned
命令),每个批次中要删除的最大文档数。
A value of 值为0
indicates that the system chooses the default value.0
表示系统选择默认值。
The following example sets 以下示例将rangeDeleterBatchSize
to 32 documents:rangeDeleterBatchSize
设置为32个文档:
mongod --setParameter rangeDeleterBatchSize=32
The parameter may also be set using the 也可以使用setParameter
command:setParameter
命令设置参数:
db.adminCommand( { setParameter: 1, rangeDeleterBatchSize: 32 } )
skipShardingConfigurationChecks
Available for 仅适用于mongod
only.mongod
。
Type: boolean
Default: false
When 如果为true
, allows for starting a shard member or config server member as a standalone for maintenance operations. true
,则允许将分片成员或配置服务器成员作为维护操作的单机启动。This parameter is mutually exclusive with the 此参数与--configsvr
or --shardsvr
options.--configsvr
或--shardsvr
选项互斥。
You can only set this parameter during start-up and cannot change this setting using the 您只能在启动期间设置此参数,不能使用setParameter
database command.setParameter
数据库命令更改此设置。
mongod --setParameter skipShardingConfigurationChecks=true
Once maintenance has completed, remove the 维护完成后,在重新启动skipShardingConfigurationChecks
parameter when restarting the mongod
.mongod
时删除skipShardingConfigurationChecks
参数。
The parameter is also available for MongoDB versions:该参数也适用于MongoDB版本:
findChunksOnConfigTimeoutMS
New in version 5.0.在版本5.0中新增。
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Type: Non-negative integer
Default: 900000
The timeout in milliseconds for find operations on chunks
.chunks
上查找操作的超时(毫秒)。
If there is a large number of chunks in the cluster and chunk loading fails with the error 如果集群中有大量块,并且块加载失败并出现ExceededTimeLimit
, increase the parameter value:ExceededTimeLimit
错误,请增加参数值:
mongod --setParameter findChunksOnConfigTimeoutMS=1000000
honorSystemUmask
Available for 仅适用于mongod
only.mongod
。
Default默认值: false
If 如果honorSystemUmask
is set to true
, new files created by MongoDB have permissions in accordance with the user's umask
settings. honorSystemUmask
设置为true
,则MongoDB创建的新文件具有与用户的umask
设置一致的权限。You cannot set 如果processUmask
if honorSystemUmask
is set to true
.honorSystemUmask
设置为true
,则无法设置processUmask
。
If 如果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. honorSystemUmask
设置为false
,则MongoDB创建的新文件的权限设置为600
,这将仅授予所有者读写权限。New directories have permissions set to 新目录的权限设置为700
. 700
。You can use 您可以使用processUmask
to override the default permissions for groups and other users on all new files created by MongoDB.processUmask
覆盖组和其他用户对MongoDB创建的所有新文件的默认权限。
You can only set this parameter during start-up and cannot change this setting using the 您只能在启动期间设置此参数,不能使用setParameter
database command.setParameter
数据库命令更改此设置。
mongod --setParameter honorSystemUmask=true
honorSystemUmask
is not available on Windows systems.在Windows系统上不可用。
journalCommitInterval
Available for 仅适用于mongod
only.mongod
。
Specify an integer between 指定一个介于1
and 500
signifying the number of milliseconds (ms) between journal commits.1
和500
之间的整数,表示日志提交之间的毫秒数(ms)。
Consider the following example which sets the 考虑以下将journalCommitInterval
to 200
ms:journalCommitInterval
设置为200
ms的示例:
db.adminCommand( { setParameter: 1, journalCommitInterval: 200 } )
minSnapshotHistoryWindowInSeconds
New in version 5.0.在版本5.0中新增。
Default默认值: 300
Available for 仅适用于mongod
only.mongod
。
The minimum time window in seconds for which the storage engine keeps the snapshot history. 存储引擎保留快照历史记录的最小时间窗口(以秒为单位)。If you query data using read concern 如果使用读取关注点"snapshot"
and specify an atClusterTime value older than the specified minSnapshotHistoryWindowInSeconds
, mongod
returns a SnapshotTooOld
error."snapshot"
查询数据,并指定比指定的minSnapshotHistoryWindowInSeconds
早的atClusterTime值,mongod
将返回SnapshotTooOld
错误。
Specify an integer greater than or equal to (指定一个大于或等于(>=
) 0.>=
)0的整数。
Consider the following example which sets the 考虑以下将minSnapshotHistoryWindowInSeconds
to 600
seconds:minSnapshotHistoryWindowInSeconds
设置为600
秒的示例:
db.adminCommand( { setParameter: 1, minSnapshotHistoryWindowInSeconds: 600 } )
Increasing the value of 增加minSnapshotHistoryWindowInSeconds
increases disk usage. minSnapshotHistoryWindowInSeconds
的值会增加磁盘使用量。For more information, see Snapshot History Retention.有关详细信息,请参阅快照历史记录保留。
To modify this value for a MongoDB Atlas cluster, you must contact Atlas Support.要修改MongoDB Atlas集群的此值,您必须联系Atlas支持部门。
processUmask
New in version 4.4.在版本4.4中新增。
Available for 仅适用于mongod
only.mongod
。
Overrides the default permissions used for groups and other users when 当honorSystemUmask
is set to false
. honorSystemUmask
设置为false
时,覆盖用于组和其他用户的默认权限。By default, when 默认情况下,当honorSystemUmask
is set to false
, new files created by MongoDB have permissions set to 600
. honorSystemUmask
设置为false
时,MongoDB创建的新文件的权限设置为600。Use the 使用processUmask
parameter to override this default with a custom umask
value. processUmask
参数用自定义umask
值覆盖此默认值。The file owner inherits permissions from the system 文件所有者从系统umask
.umask
继承权限。
You cannot set this parameter if 如果honorSystemUmask
is set to true
. honorSystemUmask
设置为true
,则无法设置此参数。You can only set this parameter during start-up and cannot change this setting using the 您只能在启动期间设置此参数,不能使用 setParameter
database command.setParameter
数据库命令更改此设置。
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:umask
设置:
mongod --setParameter processUmask=011
processUmask
is not available on Windows systems.在Windows系统上不可用。
syncdelay
Available for 仅适用于mongod
only.mongod
。
Specify the interval in seconds between fsync operations where 指定mongod
flushes its working memory to disk. mongod
将其工作内存刷新到磁盘的fsync操作之间的间隔(秒)。By default, 默认情况下,mongod
flushes memory to disk every 60 seconds. mongod
每60秒将内存刷新一次磁盘。In almost every situation you should not set this value and use the default setting.在几乎所有情况下,您都不应该设置此值并使用默认设置。
Consider the following example which sets the 考虑以下将syncdelay
to 60
seconds:syncdelay
设置为60
秒的示例:
db.adminCommand( { setParameter: 1, syncdelay: 60 } )
wiredTigerMaxCacheOverflowSizeGB
MongoDB deprecates the MongoDB不推荐使用wiredTigerMaxCacheOverflowSizeGB
parameter. wiredTigerMaxCacheOverflowSizeGB
参数。The parameter has no effect starting in MongoDB 4.4.该参数在MongoDB 4.4中启动时无效。
Default默认值: 0 (No specified maximum):0(未指定最大值)
Available for 仅适用于mongod
only.mongod
。
Specify the maximum size (in GB) for the "lookaside (or cache overflow) table" file 指定MongoDB 4.2.1-4.2x和4.0.12-4.0x的“lookaside(或缓存溢出)表”文件WiredTigerLAS.wt
for MongoDB 4.2.1-4.2.x and 4.0.12-4.0.x. WiredTigerLAS.wt
的最大大小(以GB为单位)。The file no longer exists starting in version 4.4.从4.4版开始,该文件不再存在。
The parameter can accept the following values:该参数可以接受以下值:
0 | 0 , the file size is unbounded.0 ,则文件大小不受限制。
|
number >= 0.1 | WiredTigerLAS.wt file exceeds this size, mongod exits with a fatal assertion. WiredTigerLAS.wt 文件超过此大小,mongod 将退出,并发出致命的断言。WiredTigerLAS.wt file and restart mongod .WiredTigerLAS.wt 文件并重新启动mongod 。
|
You can only set this parameter during runtime using the 只能在运行时使用setParameter
database command:setParameter
数据库命令设置此参数:
db.adminCommand( { setParameter: 1, wiredTigerMaxCacheOverflowSizeGB: 100 } )
To set the maximum size during start up, use the 要在启动期间设置最大大小,请改用storage.wiredTiger.engineConfig.maxCacheOverflowFileSizeGB
instead.storage.wiredTiger.engineConfig.maxCacheOverflowFileSizeGB
。
Available starting in MongoDB 4.2.1 (and 4.0.12)从MongoDB 4.2.1(和4.0.12)开始可用
wiredTigerConcurrentReadTransactions
Available for 仅适用于mongod
only.mongod
。
Available for the WiredTiger storage engine only.仅适用于WiredTiger存储引擎。
Specify the maximum number of concurrent read transactions allowed into the WiredTiger storage engine.指定允许进入WiredTiger存储引擎的最大并发读取事务数。
db.adminCommand( { setParameter: 1, wiredTigerConcurrentReadTransactions: <num> } )
wiredTigerConcurrentWriteTransactions
Available for 仅适用于mongod
only.mongod
。
Available for the WiredTiger storage engine only.仅适用于WiredTiger存储引擎。
Specify the maximum number of concurrent write transactions allowed into the WiredTiger storage engine.指定WiredTiger存储引擎允许的最大并发写入事务数。
db.adminCommand( { setParameter: 1, wiredTigerConcurrentWriteTransactions: <num> } )
wiredTigerEngineRuntimeConfig
Available for 仅适用于mongod
only.mongod
。
Specify 为正在运行的wiredTiger
storage engine configuration options for a running mongod
instance. mongod
实例指定wiredTiger
存储引擎配置选项。You can only set this parameter using the 只能使用setParameter
command and notusing the command line or configuration file option.setParameter
命令设置此参数,而不能使用命令行或配置文件选项。
Avoid modifying the 除非在MongoDB工程师的指导下,否则请避免修改wiredTigerEngineRuntimeConfig
unless under the direction from MongoDB engineers as this setting has major implication across both WiredTiger and MongoDB.wiredTigerEngineRuntimeConfig
,因为此设置对WiredTiger和MongoDB都有重要影响。
Consider the following operation prototype:考虑以下操作原型:
db.adminCommand({ "setParameter": 1, "wiredTigerEngineRuntimeConfig": "<option>=<setting>,<option>=<setting>" })
See the WiredTiger documentation for all available WiredTiger configuration options.有关所有可用的WiredTiger配置选项,请参阅WiredTigers文档。
auditAuthorizationSuccess
Type类型: boolean
Default默认值: false
Available only in MongoDB Enterprise and MongoDB Atlas.仅在MongoDB Enterprise和MongoDB Atlas中可用。
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Enables the auditing of authorization successes for the authCheck action.启用authCheck操作的授权成功审核。
When 当auditAuthorizationSuccess
is false
, the audit system only logs the authorization failures for authCheck
.auditAuthorizationSuccess
为false
时,审核系统仅记录authCheck
的授权失败。
To enable the audit of authorization successes, issue the following command:要启用授权成功审核,请发出以下命令:
db.adminCommand( { setParameter: 1, auditAuthorizationSuccess: true } )
Enabling 启用auditAuthorizationSuccess
degrades performance more than logging only the authorization failures.auditAuthorizationSuccess
比只记录授权失败更会降低性能。
If runtime audit configuration is enabled, the 如果启用了运行时审核配置,则auditAuthorizationSuccess
parameter should not appear in the mongod
or mongos
configuration file. auditAuthorizationSuccess
参数不应出现在mongod
或mongos
配置文件中。The server will fail to start if the parameter is present.如果存在参数,服务器将无法启动。
auditConfigPollingFrequencySecs
New in version 5.0.在版本5.0中新增。
Type类型: integer
Default默认值: 300
A sharded cluster may have servers which maintain audit configuration settings for the cluster. 分片集群可能有维护集群审核配置设置的服务器。Set the interval, in seconds, for non-configured servers to poll a config server for the current audit generation. 设置非配置服务器轮询配置服务器以获取当前审核生成的时间间隔(以秒为单位)。If this value returned differs from the previously known value, the initiating node will request the current configuration and update its internal state.如果返回的值与先前已知的值不同,则发起节点将请求当前配置并更新其内部状态。
Using the default value of 300 seconds, non-config nodes may lag up to 5 minutes behind a setAuditConfig command.使用默认值300秒,非配置节点最多可以在setAuditConfig命令后延迟5分钟。
auditEncryptionHeaderMetadataFile
New in version 5.3.在版本5.3中新增。
Type类型: string
Available only in MongoDB Enterprise. 仅在MongoDB Enterprise中可用。MongoDB Enterprise and Atlas have different configuration requirements.MongoDB Enterprise和Atlas有不同的配置要求。
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Path and file name for logging metadata audit headers for audit log encryption. 用于记录审核日志加密的元数据审核头的路径和文件名。A header is placed at the top of each audit log file and contains metadata for decrypting the audit log. 每个审核日志文件的顶部都有一个标头,其中包含用于解密审核日志的元数据。The headers are also stored in the audit log.标题也存储在审核日志中。
You can only set 您只能在启动期间在配置文件中或使用命令行上的-auditEncryptionHeaderMetadataFile
during startup in the configuration file
or with the --setParameter
option on the command line. -setParameter
选项设置auditEncryptionHeaderMetadataFile
。For example, the following sets the path and file for 例如,以下内容设置auditEncryptionHeaderMetadataFile
:auditEncryptionHeaderMetadataFile
的路径和文件:
mongod --setParameter auditEncryptionHeaderMetadataFile=/auditFiles/auditHeadersMetadataFile.log
auditEncryptKeyWithKMIPGet
New in version 5.3.在版本5.3中新增。
Type类型: boolean
Default默认值: false
Available only in MongoDB Enterprise. 仅在MongoDB Enterprise中可用。MongoDB Enterprise and Atlas have different configuration requirements.MongoDB Enterprise和Atlas有不同的配置要求。
Available for both mongod
and mongos
.mongod
和mongos
均可使用。
Enables audit log encryption for Key Management Interoperability Protocol (KMIP) servers that only support KMIP protocol version 1.0 or 1.1.为仅支持KMIP协议版本1.0或1.1的密钥管理互操作性协议(KMIP)服务器启用审核日志加密。
You can only set 您只能在启动期间在配置文件中设置auditEncryptKeyWithKMIPGet
during startup in the configuration file
or with the --setParameter
option on the command line. auditEncryptKeyWithKMIPGet
,或者在命令行上使用--setParameter
选项。For example, the following sets 例如,以下内容将auditEncryptKeyWithKMIPGet
to true
:auditEncryptKeyWithKMIPGet
设置为true
:
mongod --setParameter auditEncryptKeyWithKMIPGet=true
coordinateCommitReturnImmediatelyAfterPersistingDecision
New in version 5.0.在版本5.0中新增。
Type类型: boolean
Default默认值: true
Available for 仅适用于mongod
only.mongod
。
If 如果为true
, the shard transaction coordinator returns a multi-document transaction commit decision to the client as soon as the commit is made durable with the requested transaction write concern. true
,则在提交持久且涉及所请求的事务写入问题时,分片事务协调器立即向客户端返回多文档事务提交决定。If the client requested a write concern that is less than 如果客户机请求的写问题少于"majority"
, the commit may roll back after the decision is returned to the client."majority"
,则在将决策返回给客户机后,提交可能会回滚。
If 如果为false
, the shard transaction coordinator waits for all members to acknowledge a multi-document transaction commit before returning the commit decision to the client.false
,则分片事务协调器将等待所有成员确认多文档事务提交,然后再将提交决策返回给客户端。
The following example sets 以下示例将coordinateCommitReturnImmediatelyAfterPersistingDecision
to false
:coordinateCommitReturnImmediatelyAfterPersistingDecision
设置为false
:
mongod --setParameter coordinateCommitReturnImmediatelyAfterPersistingDecision=false
During runtime, you can also set the parameter with the 在运行时,还可以使用setParameter
command:setParameter
命令设置参数:
db.adminCommand( { setParameter: 1, coordinateCommitReturnImmediatelyAfterPersistingDecision: false } )
transactionLifetimeLimitSeconds
New in version 4.0.在版本4.0中新增。
Available for 仅适用于mongod
only.mongod
。
Default默认值: 60
Specifies the lifetime of multi-document transactions. 指定多文档事务的生存期。Transactions that exceed this limit are considered expired and will be aborted by a periodic cleanup process. 超过此限制的事务将被视为过期,并将通过定期清理进程中止。The cleanup process runs every 清理进程每事务transactionLifetimeLimitSeconds
/2 seconds or at least once every 60 seconds.transactionLifetimeLimitSeconds
/2秒或至少每60秒运行一次。
The cleanup process helps relieve storage cache pressure.清理过程有助于缓解存储缓存压力。
The minimum value for transactionLifetimeLimitSeconds is 1
second.transactionLifetimeLimitSeconds
的最小值为1
秒。
The following sets the 以下内容将transactionLifetimeLimitSeconds
to 30
seconds:transactionLifetimeLimitSeconds
设置为30
秒:
db.adminCommand( { setParameter: 1, transactionLifetimeLimitSeconds: 30 } )
You can also set parameter 您还可以在启动时设置参数transactionLifetimeLimitSeconds
at startup time.transactionLifetimeLimitSeconds
。
mongod --setParameter "transactionLifetimeLimitSeconds=30"
To set the parameter for a sharded cluster, the parameter must be modified for all shard replica set members.要设置分片集群的参数,必须修改所有分片副本集成员的参数。
Starting in MongoDB 5.0, if you change the 从MongoDB 5.0开始,如果更改transactionLifetimeLimitSeconds
parameter, you must also change transactionLifetimeLimitSeconds
to the same value on all config server replica set members. transactionLifetimeLimitSeconds
参数,还必须在所有配置服务器副本集成员上将transactionLifetimeLimitSeconds
更改为相同的值。Keeping this value consistent:保持此值一致:
maxTransactionLockRequestTimeoutMillis
New in version 4.0.在版本4.0中新增。
Available for 仅适用于mongod
only.mongod
。
Type类型: integer
Default默认值: 5
The maximum amount of time in milliseconds that multi-document transactions should wait to acquire locks required by the operations in the transaction.多文档事务应等待获取事务中操作所需锁的最长时间(毫秒)。
If the transaction cannot acquire the locks after waiting 如果事务在等待maxTransactionLockRequestTimeoutMillis
, the transaction aborts.maxTransactionLockRequestTimeoutMillis
后无法获取锁,则事务将中止。
By default, multi-document transactions wait 默认情况下,多文档事务等待5
milliseconds. 5
毫秒。That is, if the transaction cannot acquire the locks within 也就是说,如果事务无法在5毫秒内获取锁,则事务将中止。5
milliseconds, the transaction aborts. If an operation provides a greater timeout in a lock request, 如果操作在锁定请求中提供了更大的超时,maxTransactionLockRequestTimeoutMillis
overrides the operation-specific timeout.maxTransactionLockRequestTimeoutMillis
将覆盖操作特定的超时。
You can set 可以将maxTransactionLockRequestTimeoutMillis
to:maxTransactionLockRequestTimeoutMillis
设置为:
0
0
to wait the specified time to acquire the required locks. 0
的数字,用于等待指定时间获取所需的锁。-1
The following sets the 以下内容将maxTransactionLockRequestTimeoutMillis
to 20
milliseconds:maxTransactionLockRequestTimeoutMillis
设置为20
毫秒:
db.adminCommand( { setParameter: 1, maxTransactionLockRequestTimeoutMillis: 20 } )
You can also set this parameter during start-up:您还可以在启动期间设置此参数:
mongod --setParameter maxTransactionLockRequestTimeoutMillis=20
shouldMultiDocTxnCreateCollectionAndIndexes
Removed in 5.0在5.0中删除
Type类型: boolean
Default默认值: true
A flag that enables or disables the creation of a collection or an index inside transactions. 启用或禁用在事务内创建集合或索引的标志。Set the parameter to:将参数设置为:
true
false
You can set the parameter during startup or runtime.您可以在启动或运行时设置参数。
When setting the parameter for a sharded cluster, set the parameter on all shards.为分片群集设置参数时,请在所有分片上设置该参数。
To set the parameter at startup, specify the parameter in the 要在启动时设置参数,请在配置文件中或使用命令行上的configuration file
or with the --setParameter
option on the command line. --setParameter
选项指定参数。For example:例如:
mongod --setParameter shouldMultiDocTxnCreateCollectionAndIndexes=false
To modify during runtime, you can use the 要在运行时进行修改,可以使用setParameter
command; for example:setParameter
命令;例如:
db.adminCommand( { setParameter: 1, shouldMultiDocTxnCreateCollectionAndIndexes: false } )
planCacheSize
New in version 5.1.在版本5.1中新增。
Type类型: string
Default默认值: 5%
Available for 仅适用于mongod
only.mongod
。
Sets the size of the plan cache for the slot based query execution engine.设置基于槽的查询执行引擎的计划缓存的大小。
You can set the 可以将planCacheSize
value to either:planCacheSize
值设置为:
"8.5%"
."8.5%"
。MB
or GB
. MB
或GB
)。"100MB"
or "1GB"
."100MB"
或"1GB"
。Increasing the plan cache size adds more cached query shapes for the query planner. 增加计划缓存大小会为查询计划器添加更多缓存的查询形状。This can improve query performance, but increases memory usage.这可以提高查询性能,但会增加内存使用。
The following startup command sets 以下启动命令将planCacheSize
to 80 megabytes:planCacheSize
设置为80 MB:
mongod --setParameter planCacheSize="80MB"
You can also use the 您还可以在MongoDB Shell中使用setParameter
command within the MongoDB Shell:setParameter
命令:
db.adminCommand( { setParameter: 1, planCacheSize: "80MB" } )