On this page本页内容
systemLog
processManagement
cloud
net
security
setParameter
Optionstorage
operationProfiling
replication
sharding
auditLog
snmp
mongos
The following page describes the configuration options available in MongoDB 5.0. For configuration file options for other versions of MongoDB, see the appropriate version of the MongoDB Manual.下页介绍了MongoDB 5.0中可用的配置选项。有关其他版本MongoDB的配置文件选项,请参阅相应版本的MongoDB手册。
You can configure 可以在启动时使用配置文件配置mongod
and mongos
instances at startup using a configuration file. mongod
和mongos
实例。The configuration file contains settings that are equivalent to the 配置文件包含与mongod
and mongos
command-line options. mongod
和mongos
命令行选项等效的设置。See Configuration File Settings and Command-Line Options Mapping.请参见配置文件设置和命令行选项映射。
Using a configuration file makes managing 使用配置文件可以更轻松地管理mongod
and mongos
options easier, especially for large-scale deployments. mongod
和mongos
选项,尤其是对于大规模部署。You can also add comments to the configuration file to explain the server's settings.您还可以向配置文件添加注释,以解释服务器的设置。
If you installed MongoDB with a package manager such as 如果您在Linux上使用软件包管理器(如yum
or apt
on Linux or brew
on macOS, or with the MSI installer on Windows, a default configuration file has been provided as part of your installation:yum
或apt
)安装了MongoDB,在macOS上使用brew安装了MongoDB,或者在Windows上使用MSI安装程序安装了MongoDB,则在安装过程中会提供一个默认配置文件:
Linux | apt , yum , or zypper Package Managerapt 、yum 或zypper 软件包管理器 | /etc/mongod.conf |
macOS | brew |
|
Windows | MSI Installer | <install directory>\bin\mongod.cfg |
TGZ
or ZIP
file, you will need to create your own configuration file. TGZ
或ZIP
文件安装MongoDB,则需要创建自己的配置文件。MongoDB configuration files use the YAML format MongoDB配置文件使用YAML格式[1].
The following sample configuration file contains several 以下示例配置文件包含几个mongod
settings that you may adapt to your local configuration:mongod
设置,您可以根据本地配置进行调整:
YAML does not support tab characters for indentation: use spaces instead.YAML不支持缩进的制表符:请使用空格。
systemLog: destination: file path: "/var/log/mongodb/mongod.log" logAppend: true storage: journal: enabled: true processManagement: fork: true net: bindIp: 127.0.0.1 port: 27017 setParameter: enableLocalhostAuthBypass: false ...
The Linux package init scripts included in the official MongoDB packages depend on specific values for 官方MongoDB包中包含的Linux包初始化脚本取决于systemLog.path
, storage.dbPath
, and processManagement.fork
. systemLog.path
、storage.dbPath
和processManagement.fork
的特定值。If you modify these settings in the default configuration file, 如果在默认配置文件中修改这些设置,mongod
may not start.mongod
可能无法启动。
[1] | |
New in version 4.2.在版本4.2中新增。MongoDB supports using expansion directives in configuration files to load externally sourced values. MongoDB支持在配置文件中使用扩展指令来加载外部来源的值。Expansion directives can load values for specific configuration file options or load the entire configuration file.扩展指令可以加载特定配置文件选项的值,也可以加载整个配置文件。
The following expansion directives are available:以下扩展指令可用:
__rest |
|
__exec |
|
For complete documentation, see Externally Sourced Configuration File Values.有关完整文档,请参阅外部来源的配置文件值。
To configure 要使用配置文件配置mongod
or mongos
using a config file, specify the config file with the --config
option or the -f
option, as in the following examples:mongod
或mongos
,请使用--config
选项或-f
选项指定配置文件,如以下示例所示:
For example, the following uses 例如,以下使用mongod --config <configuration file>
mongos --config <configuration file>
::
mongod --config /etc/mongod.conf mongos --config /etc/mongos.conf
You can also use the 还可以使用-f
alias to specify the configuration file, as in the following:-f
别名指定配置文件,如下所示:
mongod -f /etc/mongod.conf mongos -f /etc/mongos.conf
If you installed from a package and have started MongoDB using your system's init script, you are already using a configuration file.如果您是从软件包安装的,并且已经使用系统的init脚本启动了MongoDB,那么您已经在使用配置文件。
--configExpand
If you are using expansion directives in the configuration file, you must include the 如果在配置文件中使用扩展指令,则在启动--configExpand
option when starting the mongod
or mongos
. mongod
或mongos
时必须包含--configExpand
选项。For example:例如:
mongod --config /etc/mongod.conf --configExpand "rest,exec" mongos --config /etc/mongos.conf --configExpand "rest,exec"
If the configuration file includes an expansion directive and you start the 如果配置文件包含一个扩展指令,并且您在没有在mongod
/mongos
without specifying that directive in the --configExpand
option, the mongod
/mongos
fails to start.--configExpand
选项中指定该指令的情况下启动mongod
/mongos
,则mongod
/mongos
无法启动。
For complete documentation, see Externally Sourced Configuration File Values.有关完整文档,请参阅外部来源的配置文件值。
systemLog
systemLog: verbosity: <int> quiet: <boolean> traceAllExceptions: <boolean> syslogFacility: <string> path: <string> logAppend: <boolean> logRotate: <string> destination: <string> timeStampFormat: <string> component: accessControl: verbosity: <int> command: verbosity: <int> # COMMENT additional component verbosity settings omitted for brevity
systemLog.verbosity
Type类型: integer
Default默认值: 0
The default log message verbosity level for components. 组件的默认日志消息详细级别。The verbosity level determines the amount of Informational and Debug messages MongoDB outputs. 详细级别决定MongoDB输出的信息和调试消息的数量。[2]
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
To use a different verbosity level for a named component, use the component's verbosity setting. 要为命名组件使用不同的详细级别,请使用组件的详细级别设置。For example, use the 例如,使用systemLog.component.accessControl.verbosity
to set the verbosity level specifically for ACCESS
components.systemLog.component.accessControl.verbosity
专门为ACCESS
组件设置详细级别。
See the 请参阅特定组件详细设置的systemLog.component.<name>.verbosity
settings for specific component verbosity settings.systemLog.component.<name>.verbosity
设置。
For various ways to set the log verbosity level, see Configure Log Verbosity Levels.有关设置日志详细程度的各种方法,请参阅配置日志详细程度。
[2] | D2 . D2 。D for Debug level.D 。 |
systemLog.quiet
Type类型: boolean
Default默认值: false
Run 以安静模式运行mongos
or mongod
in a quiet mode that attempts to limit the amount of output.mongos
或mongod
,尝试限制输出量。
systemLog.quiet
is not recommended for production systems as it may make tracking problems during particular connections much more difficult.不建议用于生产系统,因为这可能会使特定连接期间的跟踪问题更加困难。
systemLog.traceAllExceptions
Type类型: boolean
Default默认值: false
Print verbose information for debugging. 打印详细信息以进行调试。Use for additional logging for support-related troubleshooting.用于与支持相关的故障排除的附加日志记录。
systemLog.syslogFacility
Type类型: string
Default默认值: user
The facility level used when logging messages to syslog. 将消息记录到syslog时使用的设备级别。The value you specify must be supported by your operating system's implementation of syslog. 您指定的值必须由您的操作系统的syslog实现支持。To use this option, you must set 要使用此选项,必须将systemLog.destination
to syslog
.systemLog.destination
设置为syslog
。
systemLog.path
Type类型: string
The path of the log file to which mongod
or mongos
should send all diagnostic logging information, rather than the standard output or the host's syslog. mongod
或mongos
应将所有诊断日志信息发送到的日志文件的路径,而不是标准输出或主机的系统日志。MongoDB creates the log file at the specified path.MongoDB在指定路径创建日志文件。
The Linux package init scripts do not expect Linux包初始化脚本不希望systemLog.path
to change from the defaults. systemLog.path
改变默认值。If you use the Linux packages and change 如果使用Linux软件包并更改systemLog.path
, you will have to use your own init scripts and disable the built-in scripts.systemLog.path
,则必须使用自己的初始化脚本并禁用内置脚本。
systemLog.logAppend
Type类型: boolean
Default默认值: false
When 如果为true
, mongos
or mongod
appends new entries to the end of the existing log file when the mongos
or mongod
instance restarts. true
,则当mongos
或mongod
实例重新启动时,mongos
或mongod
会将新条目追加到现有日志文件的末尾。Without this option, 如果没有此选项,mongod
will back up the existing log and create a new file.mongod
将备份现有日志并创建一个新文件。
systemLog.logRotate
Type类型: string
Default默认值: rename
Determines the behavior for the 确定在旋转服务器日志和/或审核日志时logRotate
command when rotating the server log and/or the audit log. logRotate
命令的行为。Specify either 指定rename
or reopen
:rename
或reopen
:
rename
reopen
closes and reopens the log file following the typical Linux/Unix log rotate behavior. 按照典型的Linux/Unix日志旋转行为关闭并重新打开日志文件。Use 使用Linux/Unix logrotate实用程序时,请使用reopen
when using the Linux/Unix logrotate utility to avoid log loss.reopen
,以避免日志丢失。
If you specify 如果指定reopen
, you must also set systemLog.logAppend
to true
.reopen
,还必须将systemLog.logAppend
设置为true
。
systemLog.destination
Type类型: string
The destination to which MongoDB sends all log output. MongoDB将所有日志输出发送到的目标。Specify either 指定file
or syslog
. file
或syslog
。If you specify 如果指定file
, you must also specify systemLog.path
.file
,还必须指定systemLog.path
。
If you do not specify 如果未指定systemLog.destination
, MongoDB sends all log output to standard output.systemLog.destination
,MongoDB会将所有日志输出发送到标准输出。
The syslog
daemon generates timestamps when it logs a message, not when MongoDB issues the message. syslog
守护进程在记录消息时生成时间戳,而不是在MongoDB发出消息时。This can lead to misleading timestamps for log entries, especially when the system is under heavy load. 这可能会导致对日志条目的时间戳产生误导,尤其是在系统负载较重时。We recommend using the 我们建议在生产系统中使用file
option for production systems to ensure accurate timestamps.file
选项,以确保时间戳的准确性。
systemLog.timeStampFormat
Type类型: string
Default默认值: iso8601-local
The time format for timestamps in log messages. 日志消息中时间戳的时间格式。Specify one of the following values:指定以下值之一:
iso8601-utc | 1970-01-01T00:00:00.000Z
|
iso8601-local | 1969-12-31T19:00:00.000-05:00
|
Starting in MongoDB 4.4, 从MongoDB 4.4开始,systemLog.timeStampFormat
no longer supports ctime
. systemLog.timeStampFormat
不再支持ctime
。An example of ctime
formatted date is: ctime
格式日期的一个例子是:Wed Dec 31 18:17:54.811
.。
systemLog.component
systemLog: component: accessControl: verbosity: <int> command: verbosity: <int> # COMMENT some component verbosity settings omitted for brevity replication: verbosity: <int> election: verbosity: <int> heartbeats: verbosity: <int> initialSync: verbosity: <int> rollback: verbosity: <int> storage: verbosity: <int> journal: verbosity: <int> recovery: verbosity: <int> write: verbosity: <int>
Starting in version 4.2, MongoDB includes the Debug verbosity level (1-5) in the log messages. 从4.2版开始,MongoDB在日志消息中包含调试详细级别(1-5)。For example, if the verbosity level is 2, MongoDB logs 例如,如果详细级别为2,MongoDB将记录D2
. D2
。In previous versions, MongoDB log messages only specified 在以前的版本中,MongoDB日志消息只为调试级别指定了D
for Debug level.D
。
systemLog.component.accessControl.verbosity
Type类型: integer
Default默认值: 0
The log message verbosity level for components related to access control. 与访问控制相关的组件的日志消息详细级别。See 请参阅ACCESS
components.ACCESS
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.command.verbosity
Type类型: integer
Default默认值: 0
The log message verbosity level for components related to commands. 与命令相关的组件的日志消息详细级别。See 请参阅COMMAND
components.COMMAND
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.control.verbosity
Type类型: integer
Default默认值: 0
The log message verbosity level for components related to control operations. 与控制操作相关的组件的日志消息详细级别。See 请参阅CONTROL
components.CONTROL
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.ftdc.verbosity
Type类型: integer
Default默认值: 0
The log message verbosity level for components related to diagnostic data collection operations. 与诊断数据集合操作相关的组件的日志消息详细级别。See 请参阅FTDC
components.FTDC
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.geo.verbosity
Type类型: integer
Default默认值: 0
The log message verbosity level for components related to geospatial parsing operations. 与地理空间分析操作相关的组件的日志消息详细级别。See 请参阅GEO
components.GEO
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.index.verbosity
Type类型: integer
Default默认值: 0
The log message verbosity level for components related to indexing operations. 与索引操作相关的组件的日志消息详细级别。See 请参阅INDEX
components.INDEX
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.network.verbosity
Type类型: integer
Default默认值: 0
The log message verbosity level for components related to networking operations. 与网络操作相关的组件的日志消息详细级别。See 请参阅NETWORK
components.NETWORK
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.query.verbosity
Type类型: integer
Default默认值: 0
The log message verbosity level for components related to query operations. 与查询操作相关的组件的日志消息详细级别。See 请参阅QUERY
components.QUERY
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.replication.verbosity
Type类型: integer
Default默认值: 0
The log message verbosity level for components related to replication. 与复制相关的组件的日志消息详细级别。See 请参阅REPL
components.REPL
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.replication.election.verbosity
Type类型: integer
Default默认值: 0
New in version 4.2.在版本4.2中新增。
The log message verbosity level for components related to election. 与选举相关的组件的日志消息详细级别。See 请参阅ELECTION
components.ELECTION
组件。
If 如果未设置systemLog.component.replication.election.verbosity
is unset, systemLog.component.replication.verbosity
level also applies to election components.systemLog.component.replication.election.verbosity
,则systemLog.component.replication.verbosity
级别也适用于选举组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.replication.heartbeats.verbosity
Type类型: integer
Default默认值: 0
The log message verbosity level for components related to heartbeats. 与心跳相关的组件的日志消息详细级别。See 请参阅REPL_HB
components.REPL_HB
组件。
If 如果未设置systemLog.component.replication.heartbeats.verbosity
is unset, systemLog.component.replication.verbosity
level also applies to heartbeats components.systemLog.component.replication.heartbeats.verbosity
,则systemLog.component.replication.verbosity
级别也适用于心跳组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.replication.initialSync.verbosity
Type类型: integer
Default默认值: 0
New in version 4.2.在版本4.2中新增。
The log message verbosity level for components related to initialSync. 与initialSync相关的组件的日志消息详细级别。See 请参阅INITSYNC
components.INITSYNC
组件。
If 如果未设置systemLog.component.replication.initialSync.verbosity
is unset, systemLog.component.replication.verbosity
level also applies to initialSync components.systemLog.component.replication.initialSync.verbosity
,则systemLog.component.replication.verbosity
级别也适用于initialSync组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.replication.rollback.verbosity
Type类型: integer
Default默认值: 0
The log message verbosity level for components related to rollback. 与回滚相关的组件的日志消息详细级别。See 请参阅ROLLBACK
components.ROLLBACK
组件。
If 如果未设置systemLog.component.replication.rollback.verbosity
is unset, systemLog.component.replication.verbosity
level also applies to rollback components.systemLog.component.replication.rollback.verbosity
,则systemLog.component.replication.verbosity
级别也适用于回滚组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.sharding.verbosity
Type类型: integer
Default默认值: 0
The log message verbosity level for components related to sharding. 与分片相关的组件的日志消息详细级别。See 请参阅SHARDING
components.SHARDING
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.storage.verbosity
Type类型: integer
Default默认值: 0
The log message verbosity level for components related to storage. 与存储相关的组件的日志消息详细级别。See 请参阅STORAGE
components.STORAGE
组件。
If 如果未设置systemLog.component.storage.journal.verbosity
is unset, systemLog.component.storage.verbosity
level also applies to journaling components.systemLog.component.storage.journal.verbosity
,则systemLog.component.storage.verbosity
级别也适用于日志组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.storage.journal.verbosity
Type类型: integer
Default默认值: 0
The log message verbosity level for components related to journaling. 与日志记录相关的组件的日志消息详细级别。See 请参阅JOURNAL
components.JOURNAL
组件。
If 如果未设置systemLog.component.storage.journal.verbosity
is unset, the journaling components have the same verbosity level as the parent storage components: i.e. either the systemLog.component.storage.verbosity
level if set or the default verbosity level.systemLog.component.storage.journal.verbosity
,则日志组件与父存储组件具有相同的详细级别:即systemLog.component.storage.verbosity
级别(如果设置)或默认详细级别。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.storage.recovery.verbosity
Type类型: integer
Default默认值: 0
New in version 4.0.在版本4.0中新增。
The log message verbosity level for components related to recovery. 与恢复相关的组件的日志消息详细级别。See 请参阅RECOVERY
components.RECOVERY
组件。
If 如果未设置systemLog.component.storage.recovery.verbosity
is unset, systemLog.component.storage.verbosity
level also applies to recovery components.systemLog.component.storage.recovery.verbosity
,则systemLog.component.storage.verbosity
级别也适用于恢复组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.storage.wt.verbosity
Type类型: integer
Default默认值: -1
New in version 5.3.在版本5.3中新增。
The log message verbosity level for components related to the WiredTiger storage engine. 与WiredTiger存储引擎相关的组件的日志消息详细级别。See 请参阅WT
components.WT
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.storage.wt.wtBackup.verbosity
Type类型: integer
Default默认值: -1
New in version 5.3.在版本5.3中新增。
The log message verbosity level for components related to backup operations performed by the WiredTiger storage engine. 与WiredTiger存储引擎执行的备份操作相关的组件的日志消息详细级别。See 请参阅WTBACKUP
components.WTBACKUP
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.storage.wt.wtCheckpoint.verbosity
Type类型: integer
Default默认值: -1
New in version 5.3.在版本5.3中新增。
The log message verbosity for components related to checkpoint operations performed by the WiredTiger storage engine. 与WiredTiger存储引擎执行的检查点操作相关的组件的日志消息详细程度。See 请参阅WTCHKPT
components.WTCHKPT
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.storage.wt.wtCompact.verbosity
Type类型: integer
Default默认值: -1
New in version 5.3.在版本5.3中新增。
The log message verbosity for components related to compaction operations performed by the WiredTiger storage engine. 与WiredTiger存储引擎执行的压缩操作相关的组件的日志消息详细程度。See 请参阅WTCMPCT
components.WTCMPCT
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.storage.wt.wtEviction.verbosity
Type类型: integer
Default默认值: -1
New in version 5.3.在版本5.3中新增。
The log message verbosity for components related to eviction operations performed by the WiredTiger storage engine. 与WiredTiger存储引擎执行的逐出操作相关的组件的日志消息详细程度。See 请参阅WTEVICT
components.WTEVICT
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.storage.wt.wtHS.verbosity
Type类型: integer
Default默认值: -1
New in version 5.3.在版本5.3中新增。
The log message verbosity for components related to history store operations performed by the WiredTiger storage engine. 与WiredTiger存储引擎执行的历史存储操作相关的组件的日志消息详细程度。See 请参阅WTHS
components.WTHS
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.storage.wt.wtRecovery.verbosity
Type类型: integer
Default默认值: -1
New in version 5.3.在版本5.3中新增。
The log message verbosity for components related to recovery operations performed by the WiredTiger storage engine. 与WiredTiger存储引擎执行的恢复操作相关的组件的日志消息详细程度。See 请参阅WTRECOV
components.WTRECOV
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.storage.wt.wtRTS.verbosity
Type类型: integer
Default默认值: -1
New in version 5.3.在版本5.3中新增。
The log message verbosity for components related to rollback to stable (RTS) operations performed by the WiredTiger storage engine. 与WiredTiger存储引擎执行的回滚到稳定(RTS)操作相关的组件的日志消息详细程度。See 请参阅WTRTS
components.WTRTS
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.storage.wt.wtSalvage.verbosity
Type类型: integer
Default默认值: -1
New in version 5.3.在版本5.3中新增。
The log message verbosity for components related to salvage operations performed by the WiredTiger storage engine. 与WiredTiger存储引擎执行的修复操作相关的组件的日志消息详细程度。See 请参阅WTSLVG
components.WTSLVG
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.storage.wt.wtTiered.verbosity
Type类型: integer
Default默认值: -1
New in version 5.3.在版本5.3中新增。
The log message verbosity for components related to tiered storage operations performed by the WiredTiger storage engine. 与WiredTiger存储引擎执行的分层存储操作相关的组件的日志消息详细程度。See 请参阅WTTIER
components.WTTIER
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.storage.wt.wtTimestamp.verbosity
Type类型: integer
Default默认值: -1
New in version 5.3.在版本5.3中新增。
The log message verbosity for components related to timestamps used by the WiredTiger storage engine. 与WiredTiger存储引擎使用的时间戳相关的组件的日志消息详细程度。See 请参阅WTTS
components.WTTS
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.storage.wt.wtTransaction.verbosity
Type类型: integer
Default默认值: -1
New in version 5.3.在版本5.3中新增。
The log message verbosity for components related to transaction operations performed by the WiredTiger storage engine. 与WiredTiger存储引擎执行的事务操作相关的组件的日志消息详细程度。See 请参阅WTTXN
components.WTTXN
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.storage.wt.wtVerify.verbosity
Type类型: integer
Default默认值: -1
New in version 5.3.在版本5.3中新增。
The log message verbosity for components related to verification operations performed by the WiredTiger storage engine. 与WiredTiger存储引擎执行的验证操作相关的组件的日志消息详细程度。See 请参阅WTVRFY
components.WTVRFY
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.storage.wt.wtWriteLog.verbosity
Type类型: integer
Default默认值: -1
New in version 5.3.在版本5.3中新增。
The log message verbosity for components related to log write operations performed by the WiredTiger storage engine. 与WiredTiger存储引擎执行的日志写入操作相关的组件的日志消息详细程度。See 请参阅WTWRTLOG
components.WTWRTLOG
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.transaction.verbosity
Type类型: integer
Default默认值: 0
New in version 4.0.2.在版本4.0.2中新增。
The log message verbosity level for components related to transaction. 与事务相关的组件的日志消息详细级别。See 请参阅TXN
components.TXN
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
systemLog.component.write.verbosity
Type类型: integer
Default默认值: 0
The log message verbosity level for components related to write operations. 与写操作相关的组件的日志消息详细级别。See 请参阅WRITE
components.WRITE
组件。
The verbosity level can range from 详细程度可以在0
to 5
:0
到5
之间:
0
1
5
processManagement
processManagement: fork: <boolean> pidFilePath: <string> timeZoneInfo: <string>
processManagement.fork
Type类型: boolean
Default默认值: false
Enable a daemon mode that runs the 启用后台运行mongos
or mongod
process in the background. mongos
或mongod
进程的守护程序模式。By default 默认情况下,mongos
or mongod
does not run as a daemon: typically you will run mongos
or mongod
as a daemon, either by using processManagement.fork
or by using a controlling process that handles the daemonization process (e.g. as with upstart
and systemd
).mongos
或mongod
不作为守护进程运行:通常,您将作为守护进程运行mongos
或mongod
,可以使用processManagement.fork
,也可以使用处理守护进程的控制进程(如upstart
和systemd
)。
The Windows不支持processManagement.fork
option is not supported on Windows.processManagement.fork
选项。
The Linux package init scripts do not expect Linux包初始化脚本不希望processManagement.fork
to change from the defaults. processManagement.fork
更改默认值。If you use the Linux packages and change 如果使用Linux软件包并更改processManagement.fork
, you will have to use your own init scripts and disable the built-in scripts.processManagement.fork
,则必须使用自己的初始化脚本并禁用内置脚本。
processManagement.pidFilePath
Type类型: string
Specifies a file location to store the process ID (PID) of the 指定用于存储mongos
or mongod
process. mongos
或mongod
进程的进程ID(PID)的文件位置。The user running the 运行mongod
or mongos
process must be able to write to this path. mongod
或mongos
进程的用户必须能够写入此路径。If the 如果未指定processManagement.pidFilePath
option is not specified, the process does not create a PID file. processManagement.pidFilePath
选项,则进程不会创建PID文件。This option is generally only useful in combination with the 此选项通常仅与processManagement.fork
setting.processManagement.fork
设置结合使用。
On Linux, PID file management is generally the responsibility of your distro's init system: usually a service file in the 在Linux上,PID文件管理通常由发行版的init系统负责:通常是/etc/init.d
directory, or a systemd unit file registered with systemctl
. /etc/init.d
目录中的服务文件,或者是向systemctl
注册的systemd单元文件。Only use the 如果不使用这些初始化系统之一,请仅使用processManagement.pidFilePath
option if you are not using one of these init systems. processManagement.pidFilePath
选项。For more information, please see the respective Installation Guide for your operating system.有关更多信息,请参阅相应操作系统的安装指南。
On macOS, PID file management is generally handled by 在macOS上,PID文件管理通常由brew
. brew
处理。Only use the 只有在macOS系统上未使用brew时,才使用processManagement.pidFilePath
option if you are not using brew
on your macOS system. processManagement.pidFilePath
选项。For more information, please see the respective Installation Guide for your operating system.有关更多信息,请参阅相应操作系统的安装指南。
processManagement.timeZoneInfo
Type类型: string
The full path from which to load the time zone database. 从中加载时区数据库的完整路径。If this option is not provided, then MongoDB will use its built-in time zone database.如果未提供此选项,MongoDB将使用其内置的时区数据库。
The configuration file included with Linux and macOS packages sets the time zone database path to Linux和macOS软件包附带的配置文件默认情况下将时区数据库路径设置为/usr/share/zoneinfo
by default./usr/share/zoneinfo
。
The built-in time zone database is a copy of the Olson/IANA time zone database. 内置时区数据库是 Olson/IANA时区数据库的副本。It is updated along with MongoDB releases, but the time zone database release cycle differs from the MongoDB release cycle. 它随MongoDB版本一起更新,但时区数据库发布周期与MongoDB发布周期不同。The most recent release of the time zone database is available on our download site.时区数据库的最新版本可在下载网站上获得。
MongoDB uses the third party timelib library to provide accurate conversions between timezones. MongoDB使用第三方timelib库提供时区之间的精确转换。Due to a recent update, 由于最近的一次更新,timelib
could create inaccurate time zone conversions in older versions of MongoDB.timelib
可能会在旧版本的MongoDB中创建不准确的时区转换。
To explicitly link to the time zone database in versions of MongoDB prior to 5.0, 4.4.7, 4.2.14, and 4.0.25, download the time zone database. and use the 要在MongoDB 5.0、4.4.7、4.2.14和4.0.25之前的版本中显式链接到时区数据库,请下载时区数据库,并使用timeZoneInfo
parameter.timeZoneInfo
参数。
cloud
New in version 4.0.在版本4.0中新增。
cloud: monitoring: free: state: <string> tags: <string>
cloud.monitoring.free.state
Type类型: string
New in version 4.0.在版本4.0中新增。 Available for MongoDB Community Edition.可用于MongoDB社区版。
Enables or disables free MongoDB Cloud monitoring. 启用或禁用免费MongoDB云监控。cloud.monitoring.free.state
accepts the following values:接受以下值:
runtime |
|
on | |
off |
Once enabled, the free monitoring state remains enabled until explicitly disabled. 一旦启用,空闲监视状态将保持启用状态,直到显式禁用。That is, you do not need to re-enable each time you start the server.也就是说,无需每次启动服务器时重新启用。
For the corresponding command-line option, see 有关相应的命令行选项,请参阅--enableFreeMonitoring
.--enableFreeMonitoring
。
cloud.monitoring.free.tags
Type类型: string
New in version 4.0.在版本4.0中新增。 Available for MongoDB Community Edition.可用于MongoDB社区版。
Optional tag to describe environment context. 描述环境上下文的可选标记。The tag can be sent as part of the free MongoDB Cloud monitoring registration at start up.该标签可以在启动时作为免费MongoDB云监控注册的一部分发送。
For the corresponding command-line option, see 有关相应的命令行选项,请参阅--freeMonitoringTag
.--freeMonitoringTag
。
net
Changed in version 4.2.在版本4.2中更改。
ssl
options in favor of tls
options with identical functionality.ssl
选项,而支持具有相同功能的tls
选项。
Changed in version 5.0.在版本5.0中更改。
net.serviceExecutor
configuration option and the corresponding --serviceExecutor
command-line option.net.serviceExecutor
配置选项和相应的--serviceExecutor
命令行选项
net: port: <int> bindIp: <string> bindIpAll: <boolean> maxIncomingConnections: <int> wireObjectCheck: <boolean> ipv6: <boolean> unixDomainSocket: enabled: <boolean> pathPrefix: <string> filePermissions: <int> tls: certificateSelector: <string> clusterCertificateSelector: <string> mode: <string> certificateKeyFile: <string> certificateKeyFilePassword: <string> clusterFile: <string> clusterPassword: <string> CAFile: <string> clusterCAFile: <string> CRLFile: <string> allowConnectionsWithoutCertificates: <boolean> allowInvalidCertificates: <boolean> allowInvalidHostnames: <boolean> disabledProtocols: <string> FIPSMode: <boolean> logVersions: <string> compression: compressors: <string>
net.port
Type类型: integer
Default默认值:
mongod
(if not a shard member or a config server member) or mongos
instancemongod
(如果不是shard成员或配置服务器成员)或mongos
实例mongod
is a shard member
mongod
是shard成员则为27018mongod
is a config server member
mongod
是配置服务器成员则为27019The TCP port on which the MongoDB instance listens for client connections.MongoDB实例侦听客户端连接的TCP端口。
net.bindIp
Type类型: string
Default默认值: localhost
The hostnames and/or IP addresses and/or full Unix domain socket paths on which mongos
or mongod
should listen for client connections. mongos
或mongod
应在其上侦听客户端连接的主机名和/或IP地址和/或完整Unix域套接字路径。You may attach 您可以将mongos
or mongod
to any interface. mongos
或mongod
连接到任何接口。To bind to multiple addresses, enter a list of comma-separated values.要绑定到多个地址,请输入逗号分隔的值列表。
localhost,/tmp/mongod.sock
You can specify both IPv4 and IPv6 addresses, or hostnames that resolve to an IPv4 or IPv6 address.您可以指定IPv4和IPv6地址,或解析为IPv4或IPv6地址的主机名。
localhost, 2001:0DB8:e132:ba26:0d5c:2774:e7f9:d513
If specifying an IPv6 address or a hostname that resolves to an IPv6 address to 如果将IPv6地址或主机名解析为net.bindIp
, you must start mongos
or mongod
with net.ipv6 : true
to enable IPv6 support. net.bindIp
的IPv6地址,则必须使用netipv6:true
启动mongos
或mongod
才能启用IPv6支持。Specifying an IPv6 address to 为net.bindIp
does not enable IPv6 support.net.bindIp
指定IPv6地址不会启用IPv6支持。
If specifying a link-local IPv6 address(如果指定链路本地IPv6地址(fe80::/10
), you must append the zone index to that address (i.e. fe80::<address>%<adapter-name>
).fe80::/10
),则必须将区域索引附加到该地址(即fe80::<address>%<adapter-name>
)。
localhost,fe80::a00:27ff:fee0:1fcf%enp0s3
To avoid configuration updates due to IP address changes, use DNS hostnames instead of IP addresses. 为了避免由于IP地址更改而进行配置更新,请使用DNS主机名而不是IP地址。It is particularly important to use a DNS hostname instead of an IP address when configuring replica set members or sharded cluster members.在配置复制集成员或分片集群成员时,使用DNS主机名而不是IP地址尤为重要。
Use hostnames instead of IP addresses to configure clusters across a split network horizon. 使用主机名而不是IP地址跨拆分网络范围配置群集。Starting in MongDB 5.0, nodes that are only configured with an IP address will fail startup validation and will not start.从Mongdb5.0开始,只配置了IP地址的节点将无法启动验证,并且不会启动。
Before binding to a non-localhost (e.g. publicly accessible) IP address, ensure you have secured your cluster from unauthorized access. 在绑定到非本地主机(例如,可公开访问的)IP地址之前,请确保已保护您的群集不受未经授权的访问。For a complete list of security recommendations, see Security Checklist. 有关安全建议的完整列表,请参阅安全检查表。At minimum, consider enabling authentication and hardening network infrastructure.至少,考虑启用身份验证和加固网络基础设施。
For more information about IP Binding, refer to the IP Binding documentation.有关IP绑定的更多信息,请参阅IP绑定文档。
To bind to all IPv4 addresses, enter 要绑定到所有IPv4地址,请输入0.0.0.0
.0.0.0.0
。
To bind to all IPv4 and IPv6 addresses, enter 要绑定到所有IPv4和IPv6地址,请输入::,0.0.0.0
or starting in MongoDB 4.2, an asterisk "*"
(enclose the asterisk in quotes to distinguish from YAML alias nodes). ::,0.0.0.0
或从MongoDB 4.2开始,输入星号"*"
(将星号括在引号中以区分YAML别名节点)。Alternatively, use the 或者,使用net.bindIpAll
setting.net.bindIpAll
设置。
net.bindIp
net.bindIpAll
--bind_ip
overrides the configuration file setting net.bindIp
.--bind_ip
覆盖配置文件设置net.bindIp
。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地址。
net.bindIpAll
Type类型: boolean
Default默认值: false
If true, the 如果为mongos
or mongod
instance binds to all IPv4 addresses (i.e. 0.0.0.0
). true
,mongos
或mongod
实例将绑定到所有IPv4地址(即0.0.0.0
)。If 如果mongos
or mongod
starts with net.ipv6 : true
, net.bindIpAll
also binds to all IPv6 addresses (i.e. ::
).mongos
或mongod
以net.ipv6 : true
开头,则net.bindIpAll
也会绑定到所有IPv6地址(即::
)。
mongos
or mongod
only supports IPv6 if started with net.ipv6 : true
. mongos
或mongod
仅在使用
启动时支持IPv6。net.ipv6 : true
Specifying 仅指定net.bindIpAll
alone does not enable IPv6 support.net.bindIpAll
无法启用IPv6支持。
Before binding to a non-localhost (e.g. publicly accessible) IP address, ensure you have secured your cluster from unauthorized access. 在绑定到非本地主机(例如,可公开访问的)IP地址之前,请确保已保护您的群集不受未经授权的访问。For a complete list of security recommendations, see Security Checklist. 有关安全建议的完整列表,请参阅安全检查表。At minimum, consider enabling authentication and hardening network infrastructure.至少,考虑启用身份验证和加固网络基础设施。
For more information about IP Binding, refer to the IP Binding documentation.有关IP绑定的更多信息,请参阅IP绑定文档。
Alternatively, set 或者,将net.bindIp
to ::,0.0.0.0
or, starting in MongoDB 4.2, to an asterisk "*"
(enclose the asterisk in quotes to distinguish from YAML alias nodes) to bind to all IP addresses.net.bindIp
设置为::,0.0.0.0
,或者从MongoDB 4.2开始,设置为星号"*"
(将星号括在引号中以区别于YAML别名节点),以绑定到所有IP地址。
net.bindIp
and 和net.bindIpAll
are mutually exclusive. 相互排斥。Specifying both options causes 指定这两个选项会导致mongos
or mongod
to throw an error and terminate.mongos
或mongod
抛出错误并终止。
net.maxIncomingConnections
Type类型: integer
Default默认值: 65536
The maximum number of simultaneous connections that mongos
or mongod
will accept. mongos
或mongod
将接受的最大同时连接数。This setting has no effect if it is higher than your operating system's configured maximum connection tracking threshold.如果该设置高于操作系统配置的最大连接跟踪阈值,则该设置无效。
Do not assign too low of a value to this option, or you will encounter errors during normal application operation.不要为该选项指定太低的值,否则在正常的应用程序操作过程中会遇到错误。
This is particularly useful for a 如果您的客户端创建了多个连接,并允许它们超时,而不是关闭连接,那么这对mongos
if you have a client that creates multiple connections and allows them to timeout rather than closing them.mongos
尤其有用。
In this case, set 在这种情况下,将maxIncomingConnections
to a value slightly higher than the maximum number of connections that the client creates, or the maximum size of the connection pool.maxIncomingConnections
设置为略高于客户端创建的最大连接数或连接池的最大大小的值。
This setting prevents the 此设置可防止mongos
from causing connection spikes on the individual shards. mongos
在单个分片上造成连接峰值。Spikes like these may disrupt the operation and memory allocation of the sharded cluster.这样的峰值可能会中断分片集群的操作和内存分配。
net.wireObjectCheck
Type类型: boolean
Default默认值: true
When 如果为true
, the mongod
or mongos
instance validates all requests from clients upon receipt to prevent clients from inserting malformed or invalid BSON into a MongoDB database.true
,mongod
或mongos
实例将在收到来自客户端的所有请求时进行验证,以防止客户端将格式错误或无效的BSON插入MongoDB数据库。
For objects with a high degree of sub-document nesting, 对于具有高度子文档嵌套的对象,net.wireObjectCheck
can have a small impact on performance.net.wireObjectCheck
对性能的影响很小。
net.ipv6
Type类型: boolean
Default默认值: false
Set 将net.ipv6
to true
to enable IPv6 support. net.ipv6
设置为true
以启用IPv6支持。mongos
/mongod
disables IPv6 support by default.默认情况下禁用IPv6支持。
Setting net.ipv6
does not direct the mongos
/mongod
to listen on any local IPv6 addresses or interfaces. To configure the mongos
/mongod
to listen on an IPv6 interface, you must either:
net.bindIp
with one or more IPv6 addresses or hostnames that resolve to IPv6 addresses, ornet.bindIp
,或net.bindIpAll
to true
.net.bindIpAll
设置为true
。net.unixDomainSocket
net: unixDomainSocket: enabled: <boolean> pathPrefix: <string> filePermissions: <int>
net.unixDomainSocket.enabled
Type类型: boolean
Default默认值: true
Enable or disable listening on the UNIX domain socket. 启用或禁用UNIX域套接字上的侦听。net.unixDomainSocket.enabled
applies only to Unix-based systems.仅适用于基于Unix的系统。
When net.unixDomainSocket.enabled
is true
, mongos
or mongod
listens on the UNIX socket.
The mongos
or mongod
process always listens on the UNIX socket unless one of the following is true:mongos
或mongod
进程始终侦听UNIX套接字,除非以下情况之一为真:
net.unixDomainSocket.enabled
false
--nounixsocket
net.bindIp
net.bindIp
localhost
or its associated IP addresslocalhost
或其关联的IP地址mongos
or mongod
installed from official mongos
或mongod
由官方安装.deb and .rpm packages have the 默认情况下,bind_ip
configuration set to 127.0.0.1
by default..deb
和.rpm
包的bind_ip
配置设置为127.0.0.1
。
net.unixDomainSocket.pathPrefix
Type类型: string
Default默认值: /tmp
The path for the UNIX socket. UNIX套接字的路径。net.unixDomainSocket.pathPrefix
applies only to Unix-based systems.仅适用于基于Unix的系统。
If this option has no value, the 如果此选项没有值,mongos
or mongod
process creates a socket with /tmp
as a prefix. mongos
或mongod
进程将创建一个以/tmp
为前缀的套接字。MongoDB creates and listens on a UNIX socket unless one of the following is true:MongoDB在UNIX套接字上创建并侦听,除非以下情况之一为真:
net.unixDomainSocket.enabled
false
--nounixsocket
net.bindIp
net.bindIp
localhost
or its associated IP addresslocalhost
或其关联的IP地址net.unixDomainSocket.filePermissions
Type类型: int
Default默认值: 0700
Sets the permission for the UNIX domain socket file.设置UNIX域套接字文件的权限。
net.unixDomainSocket.filePermissions
applies only to Unix-based systems.仅适用于基于Unix的系统。
net.http
Changed in version 3.6.在版本3.6中更改。
net.http
options. net.http
选项。net.tls
New in version 4.2.在版本4.2中新增。 The tls
options provide identical functionality as the previous ssl
options.tls
选项提供与以前的ssl
选项相同的功能。
net: tls: mode: <string> certificateKeyFile: <string> certificateKeyFilePassword: <string> certificateSelector: <string> clusterCertificateSelector: <string> clusterFile: <string> clusterPassword: <string> CAFile: <string> clusterCAFile: <string> CRLFile: <string> allowConnectionsWithoutCertificates: <boolean> allowInvalidCertificates: <boolean> allowInvalidHostnames: <boolean> disabledProtocols: <string> FIPSMode: <boolean> logVersions: <string>
net.tls.mode
Type类型: string
New in version 4.2.在版本4.2中新增。
Enables TLS used for all network connections. 启用用于所有网络连接的TLS。The argument to the net.tls.mode
setting can be one of the following:net.tls.mode
设置的参数可以是以下参数之一:
disabled | |
allowTLS | |
preferTLS | |
requireTLS |
If 如果未指定--tlsCAFile
or tls.CAFile
is not specified and you are not using x.509 authentication, the system-wide CA certificate store will be used when connecting to an TLS-enabled server.--tlsCAFile
或tlsCAFile
,并且您未使用x.509身份验证,则在连接到启用TLS的服务器时,将使用系统范围的CA证书存储。
If using x.509 authentication, 如果使用x.509身份验证,则必须指定--tlsCAFile
or tls.CAFile
must be specified unless using --tlsCertificateSelector
.-tlsCAFile
或tls.CAFile
,除非使用--tlsCertificateSelector
。
For more information about TLS and MongoDB, see Configure 有关TLS和MongoDB的更多信息,请参阅为TLS/SSL配置mongod
and mongos
for TLS/SSL and TLS/SSL Configuration for Clients .mongod
和mongos
,以及用于客户端的TLS/SSL配置。
net.tls.certificateKeyFile
Type类型: string
New in version 4.2.在版本4.2中新增。 The 包含TLS证书和密钥的.pem
file that contains both the TLS certificate and key..pem
文件。
Starting with MongoDB 4.0 on macOS or Windows, you can use the 从macOS或Windows上的MongoDB 4.0开始,您可以使用net.tls.certificateSelector
setting to specify a certificate from the operating system's secure certificate store instead of a PEM key file. net.tls.certificateSelector
设置从操作系统的安全证书存储中指定证书,而不是PEM密钥文件。certificateKeyFile
and 和net.tls.certificateSelector
are mutually exclusive. 相互排斥。You can only specify one.只能指定一个。
net.tls.certificateKeyFile
when TLS is enabled.net.tls.certificateKeyFile
。On Windows or macOS, you must specify either 在Windows或macOS上,启用TLS时,必须指定net.tls.certificateKeyFile
or net.tls.certificateSelector
when TLS is enabled.net.tls.certificateKeyFile
或net.tls.certificateSelector
。
For Windows only, MongoDB 4.0 and later do not support encrypted PEM files. 仅限Windows,MongoDB 4.0及更高版本不支持加密的PEM文件。The 如果遇到加密的PEM文件,mongod
fails to start if it encounters an encrypted PEM file. mongod
将无法启动。To securely store and access a certificate for use with TLS on Windows, use 要安全地存储和访问用于Windows上TLS的证书,请使用net.tls.certificateSelector
.net.tls.certificateSelector
。
For more information about TLS and MongoDB, see Configure 有关TLS和MongoDB的更多信息,请参阅为TLS/SSL配置mongod
and mongos
for TLS/SSL and TLS/SSL Configuration for Clients .mongod
和mongos
,以及用于客户端的TLS/SSL配置。
net.tls.certificateKeyFilePassword
Type类型: string
New in version 4.2.在版本4.2中新增。 The password to de-crypt the certificate-key file (i.e. 对证书密钥文件(即certificateKeyFile
). certificateKeyFile
)进行解密的密码。Use the 仅当证书密钥文件已加密时,才使用net.tls.certificateKeyFilePassword
option only if the certificate-key file is encrypted. net.tls.certificateKeyFilePassword
选项。In all cases, the 在所有情况下,mongos
or mongod
will redact the password from all logging and reporting output.mongos
或mongod
都将从所有日志记录和报告输出中编辑密码。
Starting in MongoDB 4.0:从MongoDB 4.0开始:
net.tls.certificateKeyFilePassword
option, MongoDB will prompt for a passphrase. net.tls.certificateKeyFilePassword
选项,MongoDB将提示输入密码短语。net.tls.certificateKeyFilePassword
option. net.tls.certificateKeyFilePassword
选项。net.tls.certificateSelector
) instead of a PEM key file or use an unencrypted PEM file.net.tls.certificateSelector
)代替PEM密钥文件,或者使用未加密的PEM文件。mongod
fails if it encounters an encrypted PEM file. mongod
将失败。net.tls.certificateSelector
instead.net.tls.certificateSelector
。For more information about TLS and MongoDB, see Configure 有关TLS和MongoDB的更多信息,请参阅为TLS/SSL配置mongod
and mongos
for TLS/SSL and TLS/SSL Configuration for Clients .mongod
和mongos
,以及用于客户端的TLS/SSL配置。
net.tls.certificateSelector
Type类型: string
New in version 4.2.在版本4.2中新增。 Available on Windows and macOS as an alternative to 可在Windows和macOS上作为net.tls.certificateKeyFile
. net.tls.certificateKeyFile
的替代品使用。In MongoDB 4.0, see 在MongoDB 4.0中,请参阅net.ssl.certificateSelector
.net.ssl.certificateSelector
。
Specifies a certificate property in order to select a matching certificate from the operating system's certificate store to use for TLS/SSL.指定证书属性,以便从操作系统的证书存储中选择用于TLS/SSL的匹配证书。
net.tls.certificateKeyFile
and 和net.tls.certificateSelector
options are mutually exclusive. 选择是相互排斥的。You can only specify one.只能指定一个。
net.tls.certificateSelector
accepts an argument of the format 接受格式为<property>=<value>
where the property can be one of the following:<property>=<value>
的参数,其中属性可以是以下之一:
subject | ASCII string | |
thumbprint | hex string |
|
When using the system SSL certificate store, OCSP (Online Certificate Status Protocol) is used to validate the revocation status of certificates.使用系统SSL证书存储时,OCSP(联机证书状态协议)用于验证证书的吊销状态。
The mongod
searches the operating system's secure certificate store for the CA certificates required to validate the full certificate chain of the specified TLS certificate. mongod
在操作系统的安全证书存储中搜索验证指定TLS证书的完整证书链所需的CA证书。Specifically, the secure certificate store must contain the root CA and any intermediate CA certificates required to build the full certificate chain to the TLS certificate. 具体地说,安全证书存储必须包含根CA和构建TLS证书的完整证书链所需的任何中间CA证书。Do not use 不要使用net.tls.CAFile
or net.tls.clusterFile
to specify the root and intermediate CA certificatenet.tls.CAFile
或net.tls.clusterFile
来指定根证书和中间CA证书
For example, if the TLS certificate was signed with a single root CA certificate, the secure certificate store must contain that root CA certificate. 例如,如果TLS证书是使用单个根CA证书签名的,则安全证书存储必须包含该根CA证书。If the TLS certificate was signed with an intermediate CA certificate, the secure certificate store must contain the intermedia CA certificate and the root CA certificate.如果TLS证书是用中间CA证书签名的,则安全证书存储必须包含中间CA证书和根CA证书。
You cannot use the 当使用rotateCertificates
command or the db.rotateCertificates()
shell method when using net.tls.certificateSelector
or --tlsCertificateSelector
set to thumbprint
net.tls.certificateSelector
或--tlsCertificateSelector
设置为thumbprint
时,不能使用rotateCertificates
命令或db.rotateCertificates()
shell方法
net.tls.clusterCertificateSelector
Type类型: string
New in version 4.2.在版本4.2中新增。 Available on Windows and macOS as an alternative to 可在Windows和macOS上作为net.tls.clusterFile
.net.tls.clusterFile
的替代品使用。
Specifies a certificate property to select a matching certificate from the operating system's secure certificate store to use for internal x.509 membership authentication.指定证书属性,以从操作系统的安全证书存储中选择匹配的证书,用于内部x.509成员身份验证。
net.tls.clusterFile
and 和net.tls.clusterCertificateSelector
options are mutually exclusive. 选择是相互排斥的。You can only specify one.只能指定一个。
net.tls.clusterCertificateSelector
accepts an argument of the format 接受格式为<property>=<value>
where the property can be one of the following:<property>=<value>
的参数,其中属性可以是以下之一:
subject | ASCII string | |
thumbprint | hex string |
|
The mongod
searches the operating system's secure certificate store for the CA certificates required to validate the full certificate chain of the specified cluster certificate. mongod
在操作系统的安全证书存储中搜索验证指定群集证书的完整证书链所需的CA证书。Specifically, the secure certificate store must contain the root CA and any intermediate CA certificates required to build the full certificate chain to the cluster certificate. 具体来说,安全证书存储必须包含根CA和任何中间CA证书,这些证书是构建集群证书的完整证书链所必需的。Do not use 不要使用net.tls.CAFile
or net.tls.clusterCAFile
to specify the root and intermediate CA certificate.net.tls.CAFile
或net.tls.clusterCAFile
指定根证书和中间CA证书。
For example, if the cluster certificate was signed with a single root CA certificate, the secure certificate store must contain that root CA certificate. 例如,如果群集证书是使用单个根CA证书签名的,则安全证书存储必须包含该根CA证书。If the cluster certificate was signed with an intermediate CA certificate, the secure certificate store must contain the intermediate CA certificate and the root CA certificate.如果群集证书是用中间CA证书签名的,则安全证书存储必须包含中间CA证书和根CA证书。
Changed in version 4.4.在版本4.4中更改。
mongod
/ mongos
logs a warning on connection if the presented x.509 certificate expires within 30
days of the mongod/mongos
host system time. mongod
/mongos
主机系统时间后30天内过期,mongod
/mongos
会在连接时记录警告。net.tls.clusterFile
Type类型: string
New in version 4.2.在版本4.2中新增。The 包含x.509证书密钥文件的.pem
file that contains the x.509 certificate-key file for membership authentication for the cluster or replica set..pem
文件,用于群集或副本集的成员身份验证。
Starting with MongoDB 4.0 on macOS or Windows, you can use the 从macOS或Windows上的MongoDB 4.0开始,您可以使用net.tls.clusterCertificateSelector
option to specify a certificate from the operating system's secure certificate store instead of a PEM key file. net.tls.clusterCertificateSelector
选项从操作系统的安全证书存储中指定证书,而不是PEM密钥文件。net.tls.clusterFile
and 和net.tls.clusterCertificateSelector
options are mutually exclusive. 选择是相互排斥的。You can only specify one.只能指定一个。
If 如果nettlsclusterFile未指定用于内部群集身份验证的net.tls.clusterFile
does not specify the .pem
file for internal cluster authentication or the alternative net.tls.clusterCertificateSelector
, the cluster uses the .pem
file specified in the certificateKeyFile
setting or the certificate returned by the net.tls.certificateSelector
..pem
文件或可选的net.tls.clusterFile
,则群集将使用在certificateKeyFile
设置中指定的.pem
或net.tls.certificateSelector
返回的证书。
If using x.509 authentication, 如果使用x.509身份验证,则必须指定--tlsCAFile
or tls.CAFile
must be specified unless using --tlsCertificateSelector
.--tlsCAFile
或tls.CAFile
,除非使用--tlsCertificateSelector
。
Changed in version 4.4.在版本4.4中更改。
mongod
/ mongos
logs a warning on connection if the presented x.509 certificate expires within 30
days of the mongod/mongos
host system time. mongod
/mongos
主机系统时间后30
天内过期,mongod
/mongos
会在连接时记录警告。For more information about TLS and MongoDB, see Configure 有关TLS和MongoDB的更多信息,请参阅为TLS/SSL配置mongod
and mongos
for TLS/SSL and TLS/SSL Configuration for Clients .mongod
和mongos
,以及用于客户端的TLS/SSL配置。
For Windows only, MongoDB 4.0 and later do not support encrypted PEM files. 仅限Windows,MongoDB 4.0及更高版本不支持加密的PEM文件。The 如果遇到加密的PEM文件,mongod
fails to start if it encounters an encrypted PEM file. mongod
将无法启动。To securely store and access a certificate for use with membership authentication on Windows, use 要在Windows上安全地存储和访问用于成员身份验证的证书,请使用net.tls.clusterCertificateSelector
.net.tls.clusterCertificateSelector
。
net.tls.clusterPassword
Type类型: string
New in version 4.2.在版本4.2中新增。 The password to de-crypt the x.509 certificate-key file specified with 用于对用--sslClusterFile
. --sslClusterFile
指定的x.509证书密钥文件进行解密的密码。Use the 仅当证书密钥文件已加密时,才使用net.tls.clusterPassword
option only if the certificate-key file is encrypted. net.tls.clusterPassword
选项。In all cases, the 在所有情况下,mongos
or mongod
will redact the password from all logging and reporting output.mongos
或mongod
都将从所有日志记录和报告输出中编辑密码。
Starting in MongoDB 4.0:从MongoDB 4.0开始:
net.tls.clusterPassword
option, MongoDB will prompt for a passphrase. net.tls.clusterPassword
选项,MongoDB将提示输入密码短语。net.tls.clusterPassword
option. net.tls.clusterPassword
选项。net.tls.clusterCertificateSelector
) instead of a cluster PEM file or use an unencrypted PEM file.net.tls.clusterCertificateSelector
)代替群集PEM文件,也可以使用未加密的PEM文件。mongod
fails if it encounters an encrypted PEM file. mongod
将失败。net.tls.clusterCertificateSelector
.net.tls.clusterCertificateSelector
。For more information about TLS and MongoDB, see Configure 有关TLS和MongoDB的更多信息,请参阅为TLS/SSL配置mongod
and mongos
for TLS/SSL and TLS/SSL Configuration for Clients .mongod
和mongos
,以及用于客户端的TLS/SSL配置。
net.tls.CAFile
Type类型: string
New in version 4.2.在版本4.2中新增。 The .pem
file that contains the root certificate chain from the Certificate Authority. .pem
文件,包含来自证书颁发机构的根证书链。Specify the file name of the 使用相对或绝对路径指定.pem
file using relative or absolute paths..pem
文件的文件名。
net.tls.certificateSelector
and/or net.tls.clusterCertificateSelector
, do not use net.tls.CAFile
to specify the root and intermediate CA certificates. net.tls.certificateSelector
和/或net.tls.clusterCertificateSelector
,请不要使用net.tls.CAFile
指定根证书和中间CA证书。net.tls.certificateSelector
and/or net.tls.clusterCertificateSelector
certificates in the secure certificate store.net.tls.certificateSelector
和/或net.tls.clusterCertificateSelector
证书的完整信任链所需的所有CA证书。For more information about TLS and MongoDB, see Configure 有关TLS和MongoDB的更多信息,请参阅为TLS/SSL配置mongod
and mongos
for TLS/SSL and TLS/SSL Configuration for Clients .mongod
和mongos
,以及用于客户端的TLS/SSL配置。
net.tls.clusterCAFile
Type类型: string
New in version 4.2.在版本4.2中新增。 The .pem
file that contains the root certificate chain from the Certificate Authority used to validate the certificate presented by a client establishing a connection. .pem
文件,其中包含来自证书颁发机构的根证书链,用于验证建立连接的客户端提供的证书。Specify the file name of the 使用相对或绝对路径指定.pem
file using relative or absolute paths. .pem
文件的文件名。net.tls.clusterCAFile
requires that 要求设置net.tls.CAFile
is set.net.tls.CAFile
。
If 如果net.tls.clusterCAFile
does not specify the .pem
file for validating the certificate from a client establishing a connection, the cluster uses the .pem
file specified in the net.tls.CAFile
option.net.tls.clusterCAFile
未指定用于验证建立连接的客户端的证书的.pem
文件,则群集将使用net.tls.CAFile
选项中指定的.pem
。
net.tls.clusterCAFile
lets you use separate Certificate Authorities to verify the client to server and server to client portions of the TLS handshake允许您使用单独的证书颁发机构来验证TLS握手的客户端到服务器和服务器到客户端部分.
Starting in 4.0, on macOS or Windows, you can use a certificate from the operating system's secure store instead of a PEM key file. 从4.0开始,在macOS或Windows上,您可以使用来自操作系统安全存储的证书,而不是PEM密钥文件。See 请参阅net.tls.clusterCertificateSelector
. net.tls.clusterCertificateSelector
。When using the secure store, you do not need to, but can, also specify the 使用安全存储时,您不需要,但也可以指定net.tls.clusterCAFile
.net.tls.clusterCAFile
。
net.tls.certificateSelector
and/or net.tls.clusterCertificateSelector
, do not use net.tls.clusterCAFile
to specify the root and intermediate CA certificates. net.tls.certificateSelector
和/或net.tls.clusterCertificateSelector
,请不要使用net.tls.clusterCAFile
指定根证书和中间CA证书。net.tls.certificateSelector
and/or net.tls.clusterCertificateSelector
certificates in the secure certificate store.net.tls.certificateSelector
和/或net.tls.clusterCertificateSelector
证书的完整信任链所需的所有CA证书。For more information about TLS and MongoDB, see Configure 有关TLS和MongoDB的更多信息,请参阅为TLS/SSL配置mongod
and mongos
for TLS/SSL and TLS/SSL Configuration for Clients .mongod
和mongos
,以及用于客户端的TLS/SSL配置。
net.tls.CRLFile
Type类型: string
New in version 4.2.在版本4.2中新增。 In MongoDB 4.0 and earlier, see 在MongoDB 4.0及更早版本中,请参阅net.ssl.CRLFile
.net.ssl.CRLFile
。
The 包含证书吊销列表的.pem
file that contains the Certificate Revocation List. .pem
文件。Specify the file name of the 使用相对或绝对路径指定.pem
file using relative or absolute paths..pem
文件的文件名。
net.tls.CRLFile
on macOS. net.tls.CRLFile
。net.ssl.certificateSelector
in MongoDB 4.0 and net.tls.certificateSelector
in MongoDB 4.2+ to use the system SSL certificate store.net.ssl.certificateSelector
和MongoDB 4.2+中的net.tls.certificateSelector
以使用系统SSL证书存储。enables
the use of OCSP (Online Certificate Status Protocol) by default as an alternative to specifying a CRL file or using the system SSL certificate store.For more information about TLS and MongoDB, see Configure 有关TLS和MongoDB的更多信息,请参阅为TLS/SSL配置mongod
and mongos
for TLS/SSL and TLS/SSL Configuration for Clients .mongod
和mongos
,以及用于客户端的TLS/SSL配置。
net.tls.allowConnectionsWithoutCertificates
Type类型: boolean
New in version 4.2.在版本4.2中新增。
For clients that do not present certificates, 对于不提供证书的客户端,mongos
or mongod
bypasses TLS/SSL certificate validation when establishing the connection.mongos
或mongod
在建立连接时会绕过TLS/SSL证书验证。
For clients that present a certificate, however, 但是,对于提供证书的客户端,mongos
or mongod
performs certificate validation using the root certificate chain specified by CAFile
and reject clients with invalid certificates.mongos
或mongod
使用CAFile指定的根证书链执行证书验证,并拒绝具有无效证书的客户端。
Use the 如果混合部署包含不向或无法向net.tls.allowConnectionsWithoutCertificates
option if you have a mixed deployment that includes clients that do not or cannot present certificates to the mongos
or mongod
.mongos
或mongod
提供证书的客户端,请使用net.tls.allowConnectionsWithoutCertificates
选项。
For more information about TLS and MongoDB, see Configure 有关TLS和MongoDB的更多信息,请参阅为TLS/SSL配置mongod
and mongos
for TLS/SSL and TLS/SSL Configuration for Clients .mongod
和mongos
,以及用于客户端的TLS/SSL配置。
net.tls.allowInvalidCertificates
Type类型: boolean
New in version 4.2.在版本4.2中新增。
Enable or disable the validation checks for TLS certificates on other servers in the cluster and allows the use of invalid certificates to connect.启用或禁用群集中其他服务器上TLS证书的验证检查,并允许使用无效证书进行连接。
If you specify 如果在使用x.509身份验证时指定--tlsAllowInvalidCertificates
or tls.allowInvalidCertificates:
true
when using x.509 authentication, an invalid certificate is only sufficient to establish a TLS connection but is insufficient for authentication.--tlsAllowInvalidCertificates
或tls.allowInvalidCertificates:
true
,则无效证书仅足以建立TLS连接,但不足以进行身份验证。
When using the 使用net.tls.allowInvalidCertificates
setting, MongoDB logs a warning regarding the use of the invalid certificate.net.tls.allowInvalidCertificates
设置时,MongoDB会记录一条关于使用无效证书的警告。
For more information about TLS and MongoDB, see Configure 有关TLS和MongoDB的更多信息,请参阅为TLS/SSL配置mongod
and mongos
for TLS/SSL and TLS/SSL Configuration for Clients .mongod
和mongos
,以及用于客户端的TLS/SSL配置。
net.tls.allowInvalidHostnames
Type类型: boolean
Default默认值: false
When 当net.tls.allowInvalidHostnames
is true
, MongoDB disables the validation of the hostnames in TLS certificates, allowing mongod
to connect to MongoDB instances if the hostname their certificates do not match the specified hostname.net.tls.allowInvalidHostnames
为true
时,MongoDB将禁用TLS证书中主机名的验证,如果主机名及其证书与指定主机名不匹配,则允许mongod
连接到MongoDB实例。
For more information about TLS and MongoDB, see Configure 有关TLS和MongoDB的更多信息,请参阅为TLS/SSL配置mongod
and mongos
for TLS/SSL and TLS/SSL Configuration for Clients .mongod
和mongos
,以及用于客户端的TLS/SSL配置。
net.tls.disabledProtocols
Type类型: string
New in version 4.2.在版本4.2中新增。
Prevents a MongoDB server running with TLS from accepting incoming connections that use a specific protocol or protocols. 防止使用TLS运行的MongoDB服务器接受使用特定协议的传入连接。To specify multiple protocols, use a comma separated list of protocols.要指定多个协议,请使用逗号分隔的协议列表。
net.tls.disabledProtocols
recognizes the following protocols: 识别以下协议:TLS1_0
, TLS1_1
, TLS1_2
, and starting in version 4.0.4 (and 3.6.9), TLS1_3
.TLS1_0
、TLS1_1
、TLS1_2
,以及从版本4.0.4(和3.6.9)开始的TLS1_3
。
TLS1_1
and leave both TLS1_0
and TLS1_2
enabled. TLS1_1
并同时启用TLS1_0
和TLS1_2
。TLS1_0,TLS1_1
.TLS1_0
和TLS1_1
。TLS1_0,TLS1_1
.TLS1_0
和TLS1_1
。Starting in version 4.0, MongoDB disables the use of TLS 1.0 if TLS 1.1+ is available on the system. 从版本4.0开始,如果TLS 1.1+在系统上可用,MongoDB将禁用TLS 1.0的使用。To enable the disabled TLS 1.0, specify 要启用禁用的TLS 1.0,请为none
to net.tls.disabledProtocols
. net.tls.disabledProtocols
指定none
。See Disable TLS 1.0.请参见禁用TLS 1.0。
Members of replica sets and sharded clusters must speak at least one protocol in common.副本集和分片集群的成员必须至少使用一种通用协议。
net.tls.FIPSMode
Type类型: boolean
New in version 4.2.在版本4.2中新增。
Enable or disable the use of the FIPS mode of the TLS library for the 为mongos
or mongod
. mongos
或mongod
启用或禁用TLS库的FIPS模式。Your system must have a FIPS compliant library to use the 您的系统必须具有符合FIPS的库才能使用net.tls.FIPSMode
option.net.tls.FIPSMode
选项。
FIPS-compatible TLS/SSL is available only in MongoDB Enterprise. FIPS兼容的TLS/SSL仅在MongoDB Enterprise中可用。See Configure MongoDB for FIPS for more information.有关更多信息,请参阅为FIP配置MongoDB。
net.tls.logVersions
Type类型: string
Instructs 指示mongos
or mongod
to log a message when a client connects using a specified TLS version.mongos
或mongod
在客户端使用指定的TLS版本连接时记录消息。
Specify either a single TLS version or a comma-separated list of multiple TLS versions.指定单个TLS版本或多个TLS版本的逗号分隔列表。
To instruct 要指示mongos
or mongod
to log a message when a client connects using either TLS 1.2 or TLS 1.3, set net.tls.logVersions
to "TLS1_2,TLS1_3"
.mongos
或mongod
在客户端使用TLS1.2或TLS1.3连接时记录消息,请将net.tls.logVersions
设置为"TLS1_2,TLS1_3"
。
net.ssl
All SSL options are deprecated since 4.2. 自4.2以来,所有SSL选项都已弃用。Use the TLS counterparts instead, as they have identical functionality to the SSL options. 使用TLS对应项,因为它们具有与SSL选项相同的功能。 The SSL protocol is deprecated and MongoDB supports TLS 1.0 and later.SSL协议已被弃用,MongoDB支持TLS 1.0及更高版本。
net: ssl: # deprecated since 4.2 sslOnNormalPorts: <boolean> # deprecated since 2.6 mode: <string> PEMKeyFile: <string> PEMKeyPassword: <string> certificateSelector: <string> clusterCertificateSelector: <string> clusterFile: <string> clusterPassword: <string> CAFile: <string> clusterCAFile: <string> CRLFile: <string> allowConnectionsWithoutCertificates: <boolean> allowInvalidCertificates: <boolean> allowInvalidHostnames: <boolean> disabledProtocols: <string> FIPSMode: <boolean>
net.ssl.sslOnNormalPorts
Type类型: boolean
Deprecated since version 2.6从2.6版起已弃用: Use :改为使用net.tls.mode: requireTLS
instead.net.tls.mode: requireTLS
。
Enable or disable TLS/SSL for 为mongos
or mongod
.mongos
或mongod
启用或禁用TLS/SSL。
With 对于net.ssl.sslOnNormalPorts
, a mongos
or mongod
requires TLS/SSL encryption for all connections on the default MongoDB port, or the port specified by net.port
. net.ssl.sslOnNormalPorts
,mongos
或mongod
需要对默认MongoDB端口或net.port
指定的端口上的所有连接进行TLS/SSL加密。By default, 默认情况下,net.ssl.sslOnNormalPorts
is disabled.net.ssl.sslOnNormalPorts
处于禁用状态。
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配置。
net.ssl.mode
Type类型: string
Deprecated since version 4.2从版本4.2起已弃用: Use 答:改用net.tls.mode
instead.net.tls.mode
。
Enables TLS/SSL or mixed TLS/SSL used for all network connections. 启用用于所有网络连接的TLS/SSL或混合TLS/SSL。The argument to the net.ssl.mode
setting can be one of the following:net.ssl.mode
设置的参数可以是以下参数之一:
disabled | |
allowSSL | |
preferSSL | |
requireSSL |
Starting in version 3.4, if 从版本3.4开始,如果未指定--tlsCAFile
/net.tls.CAFile
(or their aliases --sslCAFile
/net.ssl.CAFile
) is not specified and you are not using x.509 authentication, the system-wide CA certificate store will be used when connecting to an TLS/SSL-enabled server.--tlsCAFile
/net.tls.CAFile
(或其别名--sslCAFile
/net.ssl.CAFile
),并且您未使用x.509身份验证,则在连接到启用TLS/SSL的服务器时将使用系统范围的CA证书存储。
To use x.509 authentication, 若要使用x.509身份验证,必须指定--tlsCAFile
or net.tls.CAFile
must be specified unless you are using --tlsCertificateSelector
or --net.tls.certificateSelector
.--tlsCAFile
或net.tls.CAFile
,除非您使用的是--tlsCertificateSelector
或--net.tls.certificateSelector
。
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配置。。
net.ssl.PEMKeyFile
Type类型: string
Deprecated since version 4.2从版本4.2起已弃用: Use 答:改用net.tls.certificateKeyFile
instead.net.tls.certificateKeyFile
。
The 包含TLS/SSL证书和密钥的.pem
file that contains both the TLS/SSL certificate and key..pem
文件。
Starting with MongoDB 4.0 on macOS or Windows, you can use the 从macOS或Windows上的MongoDB 4.0开始,可以使用net.ssl.certificateSelector
setting to specify a certificate from the operating system's secure certificate store instead of a PEM key file. net.ssl.certificateSelector
设置从操作系统的安全证书存储中指定证书,而不是PEM密钥文件。PEMKeyFile
and 和net.ssl.certificateSelector
are mutually exclusive. 相互排斥。You can only specify one.只能指定一个。
net.ssl.PEMKeyFile
when TLS/SSL is enabled.net.ssl.PEMKeyFile
。On Windows or macOS, you must specify either 在Windows或macOS上,启用TLS/SSL时,必须指定net.ssl.PEMKeyFile
or net.ssl.certificateSelector
when TLS/SSL is enabled.net.ssl.PEMKeyFile
或net.ssl.certificateSelector
。
For Windows only, MongoDB 4.0 and later do not support encrypted PEM files. 仅适用于Windows,MongoDB 4.0及更高版本不支持加密的PEM文件。The 如果遇到加密的PEM文件,mongod
fails to start if it encounters an encrypted PEM file. mongod
将无法启动。To securely store and access a certificate for use with TLS/SSL on Windows, use 要在Windows上安全存储和访问与TLS/SSL一起使用的证书,请使用net.ssl.certificateSelector
.net.ssl.certificateSelector
。
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配置。
net.ssl.PEMKeyPassword
Type类型: string
Deprecated since version 4.2从版本4.2起已弃用: Use :请改用net.tls.certificateKeyFilePassword
instead.net.tls.certificateKeyFilePassword
。
The password to de-crypt the certificate-key file (i.e. 对证书密钥文件(即PEMKeyFile
). PEMKeyFile
)进行解密的密码。Use the 仅当证书密钥文件已加密时,才使用net.ssl.PEMKeyPassword
option only if the certificate-key file is encrypted. net.ssl.PEMKeyPassword
选项。In all cases, the 在所有情况下,mongos
or mongod
will redact the password from all logging and reporting output.mongos
或mongod
都会从所有日志记录和报告输出中修改密码。
Starting in MongoDB 4.0:从MongoDB 4.0开始:
net.ssl.PEMKeyPassword
option, MongoDB will prompt for a passphrase. net.ssl.PEMKeyPassword
选项,MongoDB将提示输入密码短语。net.ssl.PEMKeyPassword
option. net.ssl.PEMKeyPassword
选项。net.ssl.certificateSelector
) instead of a PEM key file or use an unencrypted PEM file.net.ssl.certificateSelector
),而不是PEM密钥文件,或者使用未加密的PEM文件。mongod
fails if it encounters an encrypted PEM file. mongod
将失败。net.ssl.certificateSelector
instead.net.ssl.certificateSelector
。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配置。
net.ssl.certificateSelector
Type类型: string
Deprecated since version 4.2自4.2版以来已弃用: Use net.tls.certificateSelector
instead.
New in version 4.0.在版本4.0中新增。 Available on Windows and macOS as an alternative to 可在Windows和macOS上作为net.ssl.PEMKeyFile
.net.ssl.PEMKeyFile
的替代品使用。
Specifies a certificate property in order to select a matching certificate from the operating system's certificate store to use for TLS/SSL.指定证书属性,以便从操作系统的证书存储中选择用于TLS/SSL的匹配证书。
net.ssl.PEMKeyFile
and 和net.ssl.certificateSelector
options are mutually exclusive. 选择是相互排斥的。You can only specify one.只能指定一个。
net.ssl.certificateSelector
accepts an argument of the format 接受格式为<property>=<value>
where the property can be one of the following:<property>=<value>
的参数,其中属性可以是以下之一:
subject | ASCII string | |
thumbprint | hex string |
|
When using the system SSL certificate store, OCSP (Online Certificate Status Protocol) is used to validate the revocation status of certificates.使用系统SSL证书存储时,OCSP(联机证书状态协议)用于验证证书的吊销状态。
The mongod
searches the operating system's secure certificate store for the CA certificates required to validate the full certificate chain of the specified TLS/SSL certificate. mongod
在操作系统的安全证书存储中搜索验证指定TLS/SSL证书的完整证书链所需的CA证书。Specifically, the secure certificate store must contain the root CA and any intermediate CA certificates required to build the full certificate chain to the TLS/SSL certificate. 具体地说,安全证书存储必须包含根CA和构建TLS/SSL证书的完整证书链所需的任何中间CA证书。Do not use 不要使用net.ssl.CAFile
or net.ssl.clusterFile
to specify the root and intermediate CA certificatenet.ssl.CAFile
或net.ssl.clusterFile
指定根证书和中间CA证书
For example, if the TLS/SSL certificate was signed with a single root CA certificate, the secure certificate store must contain that root CA certificate. 例如,如果TLS/SSL证书是使用单个根CA证书签名的,则安全证书存储必须包含该根CA证书。If the TLS/SSL certificate was signed with an intermediate CA certificate, the secure certificate store must contain the intermedia CA certificate and the root CA certificate.如果TLS/SSL证书是用中间CA证书签名的,则安全证书存储必须包含中间CA证书和根CA证书。
net.ssl.clusterCertificateSelector
Type类型: string
Deprecated since version 4.2自4.2版以来已弃用: Use net.tls.clusterCertificateSelector
instead.
New in version 4.0.在版本4.0中新增。 Available on Windows and macOS as an alternative to 可在Windows和macOS上作为net.ssl.clusterFile
.net.ssl.clusterFile
的替代品使用。
Specifies a certificate property to select a matching certificate from the operating system's secure certificate store to use for internal x.509 membership authentication.指定证书属性,以从操作系统的安全证书存储中选择匹配的证书,用于内部x.509成员身份验证。
net.ssl.clusterFile
and 和net.ssl.clusterCertificateSelector
options are mutually exclusive. 选择是相互排斥的。You can only specify one.只能指定一个。
net.ssl.clusterCertificateSelector
accepts an argument of the format 接受格式<property>=<value>
where the property can be one of the following:<property>=<value>
的参数,其中属性可以是以下之一:
subject | ASCII string | |
thumbprint | hex string |
|
The mongod
searches the operating system's secure certificate store for the CA certificates required to validate the full certificate chain of the specified cluster certificate. mongod
在操作系统的安全证书存储中搜索验证指定群集证书的完整证书链所需的CA证书。Specifically, the secure certificate store must contain the root CA and any intermediate CA certificates required to build the full certificate chain to the cluster certificate. 具体来说,安全证书存储必须包含根CA和任何中间CA证书,这些证书是构建集群证书的完整证书链所必需的。Do not use 不要使用net.ssl.CAFile
or net.ssl.clusterFile
to specify the root and intermediate CA certificate.net.ssl.CAFile
或net.ssl.clusterFile
指定根证书和中间CA证书。
For example, if the cluster certificate was signed with a single root CA certificate, the secure certificate store must contain that root CA certificate. 例如,如果群集证书是使用单个根CA证书签名的,则安全证书存储必须包含该根CA证书。If the cluster certificate was signed with an intermediate CA certificate, the secure certificate store must contain the intermedia CA certificate and the root CA certificate.如果群集证书是用中间CA证书签名的,则安全证书存储必须包含中间CA证书和根CA证书。
net.ssl.clusterFile
Type类型: string
Deprecated since version 4.2自4.2版以来已弃用: Use :请改用net.tls.clusterFile
instead.net.tls.clusterFile
。
The 包含x.509证书密钥文件的.pem
file that contains the x.509 certificate-key file for membership authentication for the cluster or replica set..pem
文件,用于群集或副本集的成员身份验证。
Starting with MongoDB 4.0 on macOS or Windows, you can use the 从macOS或Windows上的MongoDB 4.0开始,您可以使用net.ssl.clusterCertificateSelector
option to specify a certificate from the operating system's secure certificate store instead of a PEM key file. net.ssl.clusterCertificateSelector
选项从操作系统的安全证书存储中指定证书,而不是PEM密钥文件。net.ssl.clusterFile
and 和net.ssl.clusterCertificateSelector
options are mutually exclusive. 选择是相互排斥的。You can only specify one.只能指定一个。
If 如果net.ssl.clusterFile
does not specify the .pem
file for internal cluster authentication or the alternative net.ssl.clusterCertificateSelector
, the cluster uses the .pem
file specified in the PEMKeyFile
setting or the certificate returned by the net.ssl.certificateSelector
.net.ssl.clusterFile
未指定用于内部群集身份验证的.pem
文件或替代net.ssl.clusterCertificateSelector
,则群集将使用PEMKeyFile
设置中指定的.pem
文件或net.ssl.certificateSelector
返回的证书。
To use x.509 authentication, 要使用x.509身份验证,必须指定--tlsCAFile
or net.tls.CAFile
must be specified unless you are using --tlsCertificateSelector
or --net.tls.certificateSelector
.-tlsCAFile
或net.tls.CAFile
,除非使用--tlsCertificateSelector
或--net.tls.certificateSelector
。
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配置。
For Windows only, MongoDB 4.0 and later do not support encrypted PEM files. 仅限Windows,MongoDB 4.0及更高版本不支持加密的PEM文件。The 如果遇到加密的PEM文件,mongod
fails to start if it encounters an encrypted PEM file. mongod
将无法启动。To securely store and access a certificate for use with membership authentication on Windows, use 要在Windows上安全地存储和访问用于成员身份验证的证书,请使用net.ssl.clusterCertificateSelector
.net.ssl.clusterCertificateSelector
。
net.ssl.clusterPassword
Type类型: string
Deprecated since version 4.2自4.2版以来已弃用: Use :请改用net.tls.clusterPassword
instead.net.tls.clusterPassword
。
The password to de-crypt the x.509 certificate-key file specified with 用于对用--sslClusterFile
. --sslClusterFile
指定的x.509证书密钥文件进行解密的密码。Use the 仅当证书密钥文件已加密时,才使用net.ssl.clusterPassword
option only if the certificate-key file is encrypted. net.ssl.clusterPassword
选项。In all cases, the 在所有情况下,mongos
or mongod
will redact the password from all logging and reporting output.mongos
或mongod
都将从所有日志记录和报告输出中编辑密码。
Starting in MongoDB 4.0:从MongoDB 4.0开始:
net.ssl.clusterPassword
option, MongoDB will prompt for a passphrase. net.ssl.clusterPassword
选项,MongoDB将提示输入密码短语。net.ssl.clusterPassword
option. net.ssl.clusterPassword
选项。net.ssl.clusterCertificateSelector
) instead of a cluster PEM file or use an unencrypted PEM file.net.ssl.clusterCertificateSelector
)代替群集PEM文件,也可以使用未加密的PEM文件。mongod
fails if it encounters an encrypted PEM file. mongod
将失败。net.ssl.clusterCertificateSelector
.net.ssl.clusterCertificateSelector
。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配置。
net.ssl.CAFile
Type类型: string
Deprecated since version 4.2自4.2版以来已弃用: Use :请改用net.tls.CAFile
instead.net.tls.CAFile
。
The .pem
file that contains the root certificate chain from the Certificate Authority. .pem
文件,包含来自证书颁发机构的根证书链的。Specify the file name of the 使用相对或绝对路径指定.pem
file using relative or absolute paths..pem
文件的文件名。
net.ssl.certificateSelector
and/or net.ssl.clusterCertificateSelector
, do not use net.ssl.CAFile
to specify the root and intermediate CA certificates. net.ssl.certificateSelector
和/或net.ssl.clusterCertificateSelector
,请不要使用net.ssl.CAFile
指定根证书和中间CA证书。net.ssl.certificateSelector
and/or net.ssl.clusterCertificateSelector
certificates in the secure certificate store.net.ssl.certificateSelector
和/或net.ssl.clusterCertificateSelector
证书的完整信任链所需的所有CA证书存储在安全证书存储中。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配置。
net.ssl.clusterCAFile
Type类型: string
Deprecated since version 4.2自4.2版以来已弃用: Use :请改用net.tls.clusterCAFile
instead.net.tls.clusterCAFile
。
The .pem
file that contains the root certificate chain from the Certificate Authority used to validate the certificate presented by a client establishing a connection. .pem
文件,其中包含来自证书颁发机构的根证书链,用于验证建立连接的客户端提供的证书。Specify the file name of the 使用相对或绝对路径指定.pem
file using relative or absolute paths. .pem
文件的文件名。net.ssl.clusterCAFile
requires that 要求net.ssl.CAFile
is set.net.ssl.CAFile
已设置。
If 如果net.ssl.clusterCAFile
does not specify the .pem
file for validating the certificate from a client establishing a connection, the cluster uses the .pem
file specified in the net.ssl.CAFile
option.net.ssl.clusterCAFile
没有指定用于验证建立连接的客户端的证书的.pem
文件,则群集将使用net.ssl.CAFile
选项中指定的.pem
文件。
net.ssl.clusterCAFile
lets you use separate Certificate Authorities to verify the client to server and server to client portions of the TLS handshake.允许您使用单独的证书颁发机构来验证TLS握手的客户端到服务器和服务器到客户端部分。
Starting in 4.0, on macOS or Windows, you can use a certificate from the operating system's secure store instead of a PEM key file. 从4.0开始,在macOS或Windows上,您可以使用来自操作系统安全存储的证书,而不是PEM密钥文件。See 请参阅net.ssl.clusterCertificateSelector
. net.ssl.clusterCertificateSelector
。When using the secure store, you do not need to, but can, also specify the 使用安全存储时,您不需要,但也可以指定net.ssl.clusterCAFile
.net.ssl.clusterCAFile
。
net.ssl.certificateSelector
and/or net.ssl.clusterCertificateSelector
, do not use net.ssl.clusterCAFile
to specify the root and intermediate CA certificates. net.ssl.certificateSelector
和/或net.ssl.clusterCertificateSelector
,请不要使用net.ssl.clusterCAFile
指定根证书和中间CA证书。net.ssl.certificateSelector
and/or net.ssl.clusterCertificateSelector
certificates in the secure certificate store.net.ssl.certificateSelector
和/或net.ssl.clusterCertificateSelector
证书的完整信任链所需的所有CA证书存储在安全证书存储中。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配置。
net.ssl.CRLFile
Type类型: string
Deprecated since version 4.2自4.2版以来已弃用: Use :改用net.tls.CRLFile
instead.net.tls.CRLFile
。
The 包含证书吊销列表的.pem
file that contains the Certificate Revocation List. .pem
文件。Specify the file name of the 使用相对或绝对路径指定.pem
file using relative or absolute paths..pem
文件的文件名。
net.ssl.CRLFile
on macOS. net.ssl.CRLFile
net.ssl.certificateSelector
in MongoDB 4.0 and net.tls.certificateSelector
in MongoDB 4.2 to use the system SSL certificate store.net.ssl.certificateSelector
和MongoDB 3.2中的net.tls.certificateSelector
。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配置。
net.ssl.allowConnectionsWithoutCertificates
Type类型: boolean
Deprecated since version 4.2从版本4.2起已弃用: Use :请改用net.tls.allowConnectionsWithoutCertificates
instead.net.tls.allowConnectionsWithoutCertificates
。
For clients that do not present certificates, 对于不提供证书的客户端,mongos
or mongod
bypasses TLS/SSL certificate validation when establishing the connection.mongos
或mongod
在建立连接时绕过TLS/SSL证书验证。
For clients that present a certificate, however, 但是,对于提供证书的客户端,mongos
or mongod
performs certificate validation using the root certificate chain specified by CAFile
and reject clients with invalid certificates.mongos
或mongod
使用CAFile
指定的根证书链执行证书验证,并拒绝具有无效证书的客户端。
Use the 如果您的混合部署包括不向net.ssl.allowConnectionsWithoutCertificates
option if you have a mixed deployment that includes clients that do not or cannot present certificates to the mongos
or mongod
.mongos
或mongod
提供证书或无法向其提供证书的客户端,请使用net.ssl.allowConnectionsWithoutCertificates
选项。
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配置。
net.ssl.allowInvalidCertificates
Type类型: boolean
Deprecated since version 4.2从版本4.2起已弃用: Use :请改用net.tls.allowInvalidCertificates
instead.net.tls.allowInvalidCertificates
。
Enable or disable the validation checks for TLS/SSL certificates on other servers in the cluster and allows the use of invalid certificates to connect.在群集中的其他服务器上启用或禁用TLS/SSL证书的验证检查,并允许使用无效证书进行连接。
Starting in MongoDB 4.2, if you specify 从MongoDB 4.2开始,如果在使用x.509身份验证时指定--tlsAllowInvalidateCertificates
or net.tls.allowInvalidCertificates: true
when using x.509 authentication, an invalid certificate is only sufficient to establish a TLS connection but it is insufficient for authentication.--tlsAllowInvalidateCertificates
或net.tls.allowInvalidCertificates: true
,则无效证书仅足以建立TLS连接,但不足以进行身份验证。
When using the 使用net.ssl.allowInvalidCertificates
setting, MongoDB logs a warning regarding the use of the invalid certificate.net.ssl.allowInvalidCertificates
设置时,MongoDB会记录有关使用无效证书的警告。
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配置。
net.ssl.allowInvalidHostnames
Type类型: boolean
Default默认值: false
Deprecated since version 4.2自4.2版以来已弃用.
Use 请改用net.tls.allowInvalidHostnames
instead.net.tls.allowInvalidHostnames
。
When 当net.ssl.allowInvalidHostnames
is true
, MongoDB disables the validation of the hostnames in TLS/SSL certificates, allowing mongod
to connect to MongoDB instances if the hostname their certificates do not match the specified hostname.net.ssl.allowInvalidHostnames
为true
时,MongoDB将禁用TLS/SSL证书中主机名的验证,如果其证书的主机名与指定的主机名不匹配,则允许mongod
连接到MongoDB实例。
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配置。
net.ssl.disabledProtocols
Type类型: string
Deprecated since version 4.2自4.2版以来已弃用: Use :请改用net.tls.disabledProtocols
instead.net.tls.disabledProtocols
。
Prevents a MongoDB server running with TLS/SSL from accepting incoming connections that use a specific protocol or protocols. 防止使用TLS/SSL运行的MongoDB服务器接受使用特定协议的传入连接。To specify multiple protocols, use a comma separated list of protocols.要指定多个协议,请使用逗号分隔的协议列表。
net.ssl.disabledProtocols
recognizes the following protocols: 识别以下协议:TLS1_0
, TLS1_1
, TLS1_2
, and starting in version 4.0.4 (and 3.6.9), TLS1_3
.TLS1_0
、TLS1_1
、TLS1_2
,以及从版本4.0.4(和3.6.9)开始的TLS1_3
。
TLS1_1
and leave both TLS1_0
and TLS1_2
enabled. TLS1_1
并同时启用TLS1_0
和TLS1_2
。TLS1_0,TLS1_1
.TLS1_0
和TLS1_1
。TLS1_0,TLS1_1
.TLS1_0,TLS1_1
。Starting in version 4.0, MongoDB disables the use of TLS 1.0 if TLS 1.1+ is available on the system. 从4.0版开始,如果系统上有TLS 1.1+,MongoDB将禁用TLS 1.0的使用。To enable the disabled TLS 1.0, specify 要启用禁用的TLS 1.0,请将为none
to net.ssl.disabledProtocols
. net.ssl.disabledProtocols
指定None
。See Disable TLS 1.0.请参见禁用TLS 1.0。
Members of replica sets and sharded clusters must speak at least one protocol in common.副本集和分片集群的成员必须至少使用一种通用协议。
net.ssl.FIPSMode
Type类型: boolean
Deprecated since version 4.2自4.2版以来已弃用: Use :请改用net.tls.FIPSMode
instead.net.tls.FIPSMode
。
Enable or disable the use of the FIPS mode of the TLS/SSL library for the 为mongos
or mongod
. mongos
或mongod
启用或禁用TLS/SSL库的FIPS模式。Your system must have a FIPS compliant library to use the 您的系统必须具有符合FIPS的库才能使用net.ssl.FIPSMode
option.net.ssl.FIPSMode
选项。
FIPS-compatible TLS/SSL is available only in MongoDB Enterprise. FIPS兼容的TLS/SSL仅在MongoDB Enterprise中可用。See Configure MongoDB for FIPS for more information.有关更多信息,请参阅为FIP配置MongoDB。
net.compression
net: compression: compressors: <string>
net.compression.compressors
Default默认值: snappy,zstd,zlib
Specifies the default compressor(s) to use for communication between this 指定用于此mongod
or mongos
instance and:mongod
或mongos
实例与以下对象之间通信的默认压缩器:
mongosh
OP_COMPRESSED
message format.OP_COMPRESSED
消息格式的驱动程序。MongoDB supports the following compressors:MongoDB支持以下压缩器:
In versions 3.6 and 4.0在版本3.6和4.0中, 默认情况下,mongod
and mongos
enable network compression by default with snappy
as the compressor.mongod
和mongos
使用snappy
作为压缩器启用网络压缩。
Starting in version 4.2从4.2版开始, 、mongod
and mongos
instances default to both snappy,zstd,zlib
compressors, in that order.mongod
和mongos
实例都默认按该顺序使用snappy,zstd,zlib
压缩器。
To disable network compression, set the value to 要禁用网络压缩,请将该值设置为disabled
.disabled
。
Messages are compressed when both parties enable network compression. 当双方都启用网络压缩时,消息会被压缩。Otherwise, messages between the parties are uncompressed.否则,双方之间的消息将被解压缩。
If you specify multiple compressors, then the order in which you list the compressors matter as well as the communication initiator. 如果指定了多个压缩器,那么列出压缩器的顺序和通信启动器同样重要。For example, if 例如,如果mongosh
specifies the following network compressors zlib,snappy
and the mongod
specifies snappy,zlib
, messages between mongosh
and mongod
uses zlib
.mongosh
指定了以下网络压缩器zlib,snappy
,而mongod
指定了snappy,zlib
,则mongosh
和mongod
之间的消息使用zlib
。
If the parties do not share at least one common compressor, messages between the parties are uncompressed. 如果双方不共享至少一个公共压缩器,则双方之间的消息将被解压缩。For example, if 例如,如果mongosh
specifies the network compressor zlib
and mongod
specifies snappy
, messages between mongosh
and mongod
are not compressed.mongosh
指定网络压缩器zlib
,而mongod
指定snappy
,则mongosh
和mongod
之间的消息不会被压缩。
security
security: keyFile: <string> clusterAuthMode: <string> authorization: <string> transitionToAuth: <boolean> javascriptEnabled: <boolean> redactClientLogData: <boolean> clusterIpSourceAllowlist: - <string> sasl: hostName: <string> serviceName: <string> saslauthdSocketPath: <string> enableEncryption: <boolean> encryptionCipherMode: <string> encryptionKeyFile: <string> kmip: keyIdentifier: <string> rotateMasterKey: <boolean> serverName: <string> port: <string> clientCertificateFile: <string> clientCertificatePassword: <string> clientCertificateSelector: <string> serverCAFile: <string> connectRetries: <int> connectTimeoutMS: <int> ldap: servers: <string> bind: method: <string> saslMechanisms: <string> queryUser: <string> queryPassword: <string | array> useOSDefaults: <boolean> transportSecurity: <string> timeoutMS: <int> userToDNMapping: <string> authz: queryTemplate: <string> validateLDAPServerConfig: <boolean>
security.keyFile
Type类型: string
The path to a key file that stores the shared secret that MongoDB instances use to authenticate to each other in a sharded cluster or replica set. 密钥文件的路径,该文件存储MongoDB实例用于在分片集群或副本集中相互验证的共享密钥。keyFile
implies security.authorization
. keyFile
意味着security.authorization
。See Internal/Membership Authentication for more information.有关更多信息,请参阅内部/成员身份验证。
Starting in MongoDB 4.2, keyfiles for internal membership authentication use YAML format to allow for multiple keys in a keyfile. 从MongoDB 4.2开始,用于内部成员身份验证的密钥文件使用YAML格式,以允许密钥文件中有多个密钥。The YAML format accepts content of:YAML格式接受以下内容:
The YAML format is compatible with the existing single-key keyfiles that use the text file format.YAML格式与使用文本文件格式的现有单键密钥文件兼容。
security.clusterAuthMode
Type类型: string
Default默认值: keyFile
The authentication mode used for cluster authentication. 用于群集身份验证的身份验证模式。If you use internal x.509 authentication, specify so here. 如果使用内部x.509身份验证,请在此处指定。This option can have one of the following values:此选项可以具有以下值之一:
keyFile | |
sendKeyFile | |
sendX509 | |
x509 |
If 如果未指定--tlsCAFile
or tls.CAFile
is not specified and you are not using x.509 authentication, the system-wide CA certificate store will be used when connecting to an TLS-enabled server.--tlsCAFile
或tls.CAFile
,并且您未使用x.509身份验证,则在连接到启用TLS的服务器时,将使用系统范围的CA证书存储。
If using x.509 authentication, --tlsCAFile
or tls.CAFile
must be specified unless using --tlsCertificateSelector
.
For more information about TLS and MongoDB, see Configure 有关TLS和MongoDB的更多信息,请参阅为TLS/SSL配置mongod
and mongos
for TLS/SSL and TLS/SSL Configuration for Clients .mongod
和mongos
,以及用于客户端的TLS/SSL配置。
security.authorization
Type类型: string
Default默认值: disabled
Enable or disable Role-Based Access Control (RBAC) to govern each user's access to database resources and operations.启用或禁用基于角色的访问控制(RBAC),以控制每个用户对数据库资源和操作的访问。
Set this option to one of the following:将此选项设置为以下选项之一:
enabled | |
disabled |
See Role-Based Access Control for more information.有关更多信息,请参阅基于角色的访问控制。
The security.authorization
setting is available only for mongod
.security.authorization
设置仅适用于mongod
。
security.transitionToAuth
Type类型: boolean
Default默认值: false
Allows the 允许mongod
or mongos
to accept and create authenticated and non-authenticated connections to and from other mongod
and mongos
instances in the deployment. mongod
或mongos
接受并创建与部署中其他mongod
和mongos
实例之间的经过身份验证和未经身份验证的连接。Used for performing rolling transition of replica sets or sharded clusters from a no-auth configuration to internal authentication. 用于执行副本集或分片群集从无身份验证配置到内部身份验证的滚动转换。Requires specifying a internal authentication mechanism such as 需要指定内部身份验证机制,如security.keyFile
.security.keyFile
。
For example, if using keyfiles for internal authentication, the 例如,如果使用密钥文件进行内部身份验证,mongod
or mongos
creates an authenticated connection with any mongod
or mongos
in the deployment using a matching keyfile. mongod
或mongos
将使用匹配的密钥文件与部署中的任何mongod
或mongos
创建经过身份验证的连接。If the security mechanisms do not match, the 如果安全机制不匹配,mongod
or mongos
utilizes a non-authenticated connection instead.mongod
或mongos
将使用未经身份验证的连接。
A 使用mongod
or mongos
running with security.transitionToAuth
does not enforce user access controls. security.transitionToAuth
运行的mongod
或mongos
不会强制执行用户访问控制。Users may connect to your deployment without any access control checks and perform read, write, and administrative operations.用户可以在不进行任何访问控制检查的情况下连接到部署,并执行读、写和管理操作。
A 使用内部身份验证而不使用mongod
or mongos
running with internal authentication and without security.transitionToAuth
requires clients to connect using user access controls. security.transitionToAuth
运行的mongod
或mongos
要求客户端使用用户访问控制进行连接。Update clients to connect to the 在不使用mongod
or mongos
using the appropriate user prior to restarting mongod
or mongos
without security.transitionToAuth
.security.transitionToAuth
的情况下重新启动mongod
或mongos
之前,使用适当的用户更新客户端以连接到mongod
和mongos
。
security.javascriptEnabled
Type类型: boolean
Default默认值: true
Enables or disables server-side JavaScript execution. 启用或禁用服务器端JavaScript执行。When disabled, you cannot use operations that perform server-side execution of JavaScript code, such as the 禁用时,不能使用执行JavaScript代码服务器端执行的操作,例如$where
query operator, mapReduce
command, $accumulator
, and $function
.$where
查询运算符、mapReduce
命令、$accumulator
和$function
。
If you do not use these operations, disable server-side scripting.如果不使用这些操作,请禁用服务器端脚本。
Starting in version 4.4, the 从4.4版开始,security.javascriptEnabled
is available for both mongod
and mongos
. security.javascriptEnabled
可用于mongod
和mongos
。In earlier versions, the setting is only available for 在早期版本中,该设置仅适用于mongod
.mongod
。
security.redactClientLogData
Type类型: boolean
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
A 使用mongod
or mongos
running with security.redactClientLogData
redacts any message accompanying a given log event before logging. security.redactClientLogData
运行的mongod
或mongos
会在日志记录之前编辑任何伴随给定日志事件的消息。This prevents the 这可防止mongod
or mongos
from writing potentially sensitive data stored on the database to the diagnostic log. mongod
或mongos
将数据库中存储的潜在敏感数据写入诊断日志。Metadata such as error or operation codes, line numbers, and source file names are still visible in the logs.错误或操作代码、行号和源文件名等元数据仍在日志中可见。
Use 将security.redactClientLogData
in conjunction with Encryption at Rest and TLS/SSL (Transport Encryption) to assist compliance with regulatory requirements.security.redactClientLogData
与静态加密和TLS/SSL(传输加密)结合使用,以帮助遵守法规要求。
For example, a MongoDB deployment might store Personally Identifiable Information (PII) in one or more collections. 例如,MongoDB部署可能会在一个或多个集合中存储个人身份信息(PII)。The mongod
or mongos
logs events such as those related to CRUD operations, sharding metadata, etc. mongod
或mongos
记录与CRUD操作、分片元数据等相关的事件。It is possible that the mongod
or mongos
may expose PII as a part of these logging operations. mongod
或mongos
可能会在这些日志记录操作中公开PII。A 使用mongod
or mongos
running with security.redactClientLogData
removes any message accompanying these events before being output to the log, effectively removing the PII.security.redactClientLogData
运行的mongod
或mongos
会在输出到日志之前删除伴随这些事件的任何消息,从而有效地删除PII。
Diagnostics on a 由于缺少与日志事件相关的数据,在运行mongod
or mongos
running with security.redactClientLogData
may be more difficult due to the lack of data related to a log event. security.redactClientLogData
的mongod
或mongos
上进行诊断可能会更加困难。See the process logging manual page for an example of the effect of 有关security.redactClientLogData
on log output.security.redactClientLogData
对日志输出的影响的示例,请参阅流程日志记录手册页面。
On a running 在运行的mongod
or mongos
, use setParameter
with the redactClientLogData
parameter to configure this setting.mongod
或mongos
上,使用setParameter
配合redactClientLogData
参数来配置此设置。
security.clusterIpSourceAllowlist
Type类型: list
New in version 5.0.在版本5.0中新增。
A list of IP addresses/CIDR (Classless Inter-Domain Routing) ranges against which the IP地址/CIDR(无类域间路由)范围的列表,mongod
validates authentication requests from other members of the replica set and, if part of a sharded cluster, the mongos
instances. mongod
根据该列表验证来自副本集其他成员的身份验证请求,如果是分片集群的一部分,则验证来自mongos
实例的身份验证请求。The mongod
verifies that the originating IP is either explicitly in the list or belongs to a CIDR range in the list. mongod
验证源IP是否显式位于列表中,或者是否属于列表中的CIDR范围。If the IP address is not present, the server does not authenticate the 如果IP地址不存在,服务器不会对mongod
or mongos
.mongod
或mongos
进行身份验证。
security.clusterIpSourceAllowlist
has no effect on a mongod
started without authentication.security.clusterIpSourceAllowlist
对未经身份验证启动的mongod
无效。
security.clusterIpSourceAllowlist
requires specifying each IPv4/6 address or Classless Inter-Domain Routing (CIDR) range as a YAML list:需要将每个IPv4/6地址或无类别域间路由(CIDR)范围指定为YAML列表:
security: clusterIpSourceAllowlist: - 192.0.2.0/24 - 127.0.0.1 - ::1
Ensure 确保security.clusterIpSourceAllowlist
includes the IP address or CIDR ranges that include the IP address of each replica set member or mongos
in the deployment to ensure healthy communication between cluster components.security.clusterIpSourceAllowlist
包含IP地址或CIDR范围,其中包括部署中每个副本集成员或mongos
的IP地址,以确保群集组件之间的正常通信。
security.clusterIpSourceWhitelist
Type类型: list
Deprecated in version 5.0:5.0版中已弃用: Use 请改用security.clusterIpSourceAllowlist
instead.security.clusterIpSourceAllowlist
。
A list of IP addresses/CIDR (Classless Inter-Domain Routing) ranges against which the IP地址/CIDR(无类域间路由)范围的列表,mongod
validates authentication requests from other members of the replica set and, if part of a sharded cluster, the mongos
instances. mongod
根据该列表验证来自副本集其他成员的身份验证请求,如果是分片集群的一部分,则验证来自mongos
实例的身份验证请求。The mongod
verifies that the originating IP is either explicitly in the list or belongs to a CIDR range in the list. mongod
验证源IP是否显式位于列表中,或者是否属于列表中的CIDR范围。If the IP address is not present, the server does not authenticate the 如果IP地址不存在,服务器不会对mongod
or mongos
.mongod
或mongos
进行身份验证。
security.clusterIpSourceWhitelist
has no effect on a 对未经身份验证启动的mongod
started without authentication.mongod
无效。
security.clusterIpSourceWhitelist
requires specifying each IPv4/6 address or Classless Inter-Domain Routing (CIDR) range as a YAML list:需要将每个IPv4/6地址或无类别域间路由(CIDR)范围指定为YAML列表:
security: clusterIpSourceWhitelist: - 192.0.2.0/24 - 127.0.0.1 - ::1
Ensure 确保security.clusterIpSourceWhitelist
includes the IP address or CIDR ranges that include the IP address of each replica set member or mongos
in the deployment to ensure healthy communication between cluster components.security.clusterIpSourceWhitelist
白名单包含IP地址或CIDR范围,其中包括部署中每个副本集成员或mongos
的IP地址,以确保群集组件之间的正常通信。
security: enableEncryption: <boolean> encryptionCipherMode: <string> encryptionKeyFile: <string> kmip: keyIdentifier: <string> rotateMasterKey: <boolean> serverName: <string> port: <string> clientCertificateFile: <string> clientCertificatePassword: <string> clientCertificateSelector: <string> serverCAFile: <string> connectRetries: <int> connectTimeoutMS: <int> activateKeys: <boolean> keyStatePollingSeconds: <int>
security.enableEncryption
Type类型: boolean
Default默认值: false
Enables encryption for the WiredTiger storage engine. 为WiredTiger存储引擎启用加密。You must set to 必须设置为true
to pass in encryption keys and configurations.true
才能传入加密密钥和配置。
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
security.encryptionCipherMode
Type类型: string
Default默认值: AES256-CBC
The cipher mode to use for encryption at rest:静止时用于加密的密码模式:
Mode | |
---|---|
AES256-CBC | |
AES256-GCM |
AES256-GCM . AES256-GCM 。 |
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
security.encryptionKeyFile
Type类型: string
The path to the local keyfile when managing keys via process other than KMIP. 通过KMIP以外的进程管理密钥时本地密钥文件的路径。Only set when managing keys via process other than KMIP. 仅在通过KMIP以外的进程管理密钥时设置。If data is already encrypted using KMIP, MongoDB will throw an error.如果数据已经使用KMIP加密,MongoDB将抛出一个错误。
Requires 要求security.enableEncryption
to be true
.security.enableEncryption
为true
。
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
security.kmip.keyIdentifier
Type类型: string
Unique KMIP identifier for an existing key within the KMIP server. KMIP服务器中现有密钥的唯一KMIP标识符。Include to use the key associated with the identifier as the system key. Include将与标识符关联的密钥用作系统密钥。You can only use the setting the first time you enable encryption for the 只能在首次为mongod
instance. mongod
实例启用加密时使用该设置。Requires 要求security.enableEncryption
to be true.<security.enableEncryption
为true
</p>
If unspecified, MongoDB will request that the KMIP server create a new key to utilize as the system key.如果未指定,MongoDB将请求KMIP服务器创建一个新密钥,用作系统密钥。
If the KMIP server cannot locate a key with the specified identifier or the data is already encrypted with a key, MongoDB will throw an error.如果KMIP服务器找不到具有指定标识符的密钥,或者数据已经用密钥加密,MongoDB将抛出错误。
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
security.kmip.rotateMasterKey
Type类型: boolean
Default默认值: false
If true, rotate the master key and re-encrypt the internal keystore.如果为true
,则旋转主密钥并重新加密内部密钥库。
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
security.kmip.serverName
Type类型: string
Hostname or IP address of the KMIP server to connect to. 要连接的KMIP服务器的主机名或IP地址。Requires 要求security.enableEncryption
to be true.security.enableEncryption
为true
。
Starting in MongoDB 4.2.1 (and 4.0.14), you can specify multiple KMIP servers as a comma-separated list, e.g. 从MongoDB 4.2.1(和4.0.14)开始,可以将多个KMIP服务器指定为逗号分隔的列表,例如server1.example.com,server2.example.com
. server1.example.com,server2.example.com
。On startup, the 启动时,mongod
will attempt to establish a connection to each server in the order listed, and will select the first server to which it can successfully establish a connection. KMIP server selection occurs only at startup.mongod
将尝试按照列出的顺序与每台服务器建立连接,并选择第一台可以成功建立连接的服务器。KMIP服务器选择仅在启动时发生。
When connecting to a KMIP server, the 连接到KMIP服务器时,mongod
verifies that the specified security.kmip.serverName
matches the Subject Alternative Name SAN
(or, if SAN
is not present, the Common Name CN
) in the certificate presented by the KMIP server. mongod
会验证指定的security.kmip.serverName
是否与KMIP服务器提供的证书中的主题替代名称SAN
(或者,如果SAN
不存在,则与通用名称CN
)匹配。If 如果存在SAN
is present, mongod
does not match against the CN
. SAN
,则mongod
不与CN
匹配。If the hostname does not match the 如果主机名与SAN
(or CN
), the mongod
will fail to connect.SAN
(或CN
)不匹配,mongod
将无法连接。
Starting in MongoDB 4.2, when performing comparison of SAN, MongoDB supports comparison of DNS names or IP addresses. 从MongoDB 4.2开始,在执行SAN比较时,MongoDB支持DNS名称或IP地址的比较。In previous versions, MongoDB only supports comparisons of DNS names.在以前的版本中,MongoDB只支持DNS名称的比较。
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
security.kmip.port
Type类型: string
Default默认值: 5696
Port number to use to communicate with the KMIP server. 用于与KMIP服务器通信的端口号。Requires 需要security.kmip.serverName
. security.kmip.serverName
。Requires 要求security.enableEncryption
to be true.security.enableEncryption
为true
。
If specifying multiple KMIP servers with 如果使用security.kmip.serverName
, the mongod
will use the port specified with security.kmip.port
for all provided KMIP servers.security.kmip.serverName
指定多个KMIP服务器,mongod
将使用security.kmip.port
为所有提供的KMIP服务器指定的端口。
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
security.kmip.clientCertificateFile
Type类型: string
String containing the path to the client certificate used for authenticating MongoDB to the KMIP server. 字符串,其中包含用于向KMIP服务器验证MongoDB的客户端证书的路径。Requires that a 要求提供security.kmip.serverName
be provided.security.kmip.serverName
。
Starting in 4.0, on macOS or Windows, you can use a certificate from the operating system's secure store instead of a PEM key file. 从4.0开始,在macOS或Windows上,您可以使用来自操作系统安全存储的证书,而不是PEM密钥文件。See 请参阅security.kmip.clientCertificateSelector
.security.kmip.clientCertificateSelector
。
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
security.kmip.clientCertificatePassword
Type类型: string
The password to decrypt the client certificate (i.e. 解密客户端证书(即security.kmip.clientCertificateFile
), used to authenticate MongoDB to the KMIP server. security.kmip.clientCertificateFile
)的密码,用于向KMIP服务器验证MongoDB。Use the option only if the certificate is encrypted.仅当证书已加密时才使用该选项。
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
security.kmip.clientCertificateSelector
Type类型: string
New in version 4.0.在版本4.0中新增。 (and 4.2.15, 4.4.7, and 5.0)
Available on Windows and macOS as an alternative to 可在Windows和macOS上作为security.kmip.clientCertificateFile
.security.kmip.clientCertificateFile
的替代品使用。
security.kmip.clientCertificateFile
and 和security.kmip.clientCertificateSelector
options are mutually exclusive. 选择是相互排斥的。You can only specify one.只能指定一个。
Specifies a certificate property in order to select a matching certificate from the operating system's certificate store to authenticate MongoDB to the KMIP server.指定证书属性,以便从操作系统的证书存储中选择匹配的证书,以将MongoDB验证到KMIP服务器。
security.kmip.clientCertificateSelector
accepts an argument of the format 接受格式为<property>=<value>
where the property can be one of the following:<property>=<value>
的参数,其中属性可以是以下之一:
subject | ASCII string | |
thumbprint | hex string |
|
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
security.kmip.serverCAFile
Type类型: string
Path to CA File. CA文件的路径。Used for validating secure client connection to KMIP server.用于验证与KMIP服务器的安全客户端连接。
Starting in 4.0, on macOS or Windows, you can use a certificate from the operating system's secure store instead of a PEM key file. 从4.0开始,在macOS或Windows上,您可以使用来自操作系统安全存储的证书,而不是PEM密钥文件。See 请参阅security.kmip.clientCertificateSelector
. security.kmip.clientCertificateSelector
。When using the secure store, you do not need to, but can, also specify the 使用安全存储时,您不需要,但也可以指定security.kmip.serverCAFile
.security.kmip.serverCAFile
。
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
security.kmip.connectRetries
Type类型: int
Default默认值: 0
New in version 4.4.在版本4.4中新增。
How many times to retry the initial connection to the KMIP server. 重试与KMIP服务器的初始连接的次数。Use together with 与connectTimeoutMS
to control how long the mongod
waits for a response between each retry.connectTimeoutMS
一起使用可控制mongod
在每次重试之间等待响应的时间。
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
security.kmip.connectTimeoutMS
Type类型: int
Default默认值: 5000
New in version 4.4.在版本4.4中新增。
Timeout in milliseconds to wait for a response from the KMIP server. 等待KMIP服务器响应的超时(毫秒)。If the 如果指定了connectRetries
setting is specified, the mongod
will wait up to the value specified with connectTimeoutMS
for each retry.connectRetries
设置,mongod
将在每次重试时等待connectTimeoutMS
指定的值。
Value must be 值必须为1000
or greater.1000
或更大。
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
security.kmip.activateKeys
Type类型: boolean
Default默认值: true
New in version 5.3.在版本5.3中新增。
Activates all newly created KMIP keys upon creation and then periodically checks those keys are in an active state.在创建时激活所有新创建的KMIP密钥,然后定期检查这些密钥是否处于活动状态。
When 当security.kmip.activateKeys
is true
and you have existing keys on a KMIP server, the key must be activated first or the mongod
node will fail to start.security.kmip.activateKeys
为true
且KMIP服务器上存在密钥时,必须首先激活密钥,否则mongod
节点将无法启动。
If the key being used by the mongod transitions into a non-active state, the 如果mongod
node will shut down unless kmipActivateKeys
is false. mongod
使用的密钥转换为非活动状态,mongod
节点将关闭,除非kmipActivateKeys
为false
。To ensure you have an active key, rotate the KMIP master key by using 要确保您拥有活动密钥,请使用security.kmip.rotateMasterKey
.security.kmip.rotateMasterKey
旋转KMIP主密钥。
security.sasl
security: sasl: hostName: <string> serviceName: <string> saslauthdSocketPath: <string>
security.sasl.hostName
Type类型: string
A fully qualified server domain name for the purpose of configuring SASL and Kerberos authentication. 用于配置SASL和Kerberos身份验证的完全限定的服务器域名。The SASL hostname overrides the hostname only for the configuration of SASL and Kerberos.SASL主机名仅在配置SASL和Kerberos时覆盖主机名。
security.sasl.serviceName
Type类型: string
Registered name of the service using SASL. 使用SASL的服务的注册名称。This option allows you 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 permits setting this option only at startup. MongoDB只允许在启动时设置此选项。The setParameter
can not change this setting.setParameter
无法更改此设置。
This option is available only in MongoDB Enterprise.此选项仅在MongoDB Enterprise中可用。
Ensure that your driver supports alternate service names. 确保驱动程序支持备用服务名称。For 有关连接到新mongosh
and other MongoDB tools to connect to the new serviceName
, see the gssapiServiceName
option.serviceName
的mongosh
和其他MongoDB工具,请参阅gssapiServiceName
选项。
security.ldap
security: ldap: servers: <string> bind: method: <string> saslMechanisms: <string> queryUser: <string> queryPassword: <string | array> useOSDefaults: <boolean> transportSecurity: <string> timeoutMS: <int> userToDNMapping: <string> authz: queryTemplate: <string> validateLDAPServerConfig: <boolean>
security.ldap.servers
Type类型: string
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
The LDAP server against which the mongod
or mongos
authenticates users or determines what actions a user is authorized to perform on a given database. mongod
或mongos
对用户进行身份验证或确定用户有权对给定数据库执行哪些操作的LDAP服务器。If the LDAP server specified has any replicated instances, you may specify the host and port of each replicated server in a comma-delimited list.如果指定的LDAP服务器有任何复制实例,则可以在逗号分隔的列表中指定每个复一致性务器的主机和端口。
If your LDAP infrastructure partitions the LDAP directory over multiple LDAP servers, specify one LDAP server or any of its replicated instances to 如果LDAP基础结构将LDAP目录划分到多个LDAP服务器上,请指定一个LDAP服务器或其任何复制到security.ldap.servers
. security.ldap.servers
的实例。MongoDB supports following LDAP referrals as defined in RFC 4511 4.1.10. MongoDB支持RFC 4511 4.1.10中定义的以下LDAP引用。Do not use 不要使用security.ldap.servers
for listing every LDAP server in your infrastructure.security.ldap.servers
列出基础结构中的每台LDAP服务器。
This setting can be configured on a running 可以使用mongod
or mongos
using setParameter
.setParameter
在运行中的mongod
或mongos
上配置此设置。
If unset, 如果未设置,mongod
or mongos
cannot use LDAP authentication or authorization.mongod
或mongos
将无法使用LDAP身份验证或授权。
security.ldap.bind.queryUser
Type类型: string
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
The identity with which 连接到LDAP服务器或在LDAP服务器上执行查询时,mongod
or mongos
binds as, when connecting to or performing queries on an LDAP server.mongod
或mongos
绑定为的标识。
Only required if any of the following are true:仅当以下任何一项为真时才需要:
security.ldap.userToDNMapping
.security.ldap.userToDNMapping
。You must use 您必须将queryUser
with queryPassword
.queryUser
与queryPassword
一起使用。
If unset, 如果未设置,mongod
or mongos
will not attempt to bind to the LDAP server.mongod
或mongos
将不会尝试绑定到LDAP服务器。
This setting can be configured on a running 可以使用mongod
or mongos
using setParameter
.setParameter
在运行中的mongod
或mongos
上配置此设置。
Windows MongoDB deployments can use Windows MongoDB部署可以使用useOSDefaults
instead of queryUser
and queryPassword
. useOSDefaults
,而不是queryUser
和queryPassword
。You cannot specify both 不能同时指定queryUser
and useOSDefaults
at the same time.queryUser
和useOSDefaults
。
security.ldap.bind.queryPassword
Type类型: string or array
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
The password used to bind to an LDAP server when using 使用queryUser
. queryUser
时用于绑定到LDAP服务器的密码。You must use 您必须在queryPassword
with queryUser
.queryUser
中使用queryPassword
。
If not set, 如果未设置,mongod
or mongos
does not attempt to bind to the LDAP server.mongod
或mongos
不会尝试绑定到LDAP服务器。
You can configure this setting on a running 可以使用mongod
or mongos
using setParameter
.setParameter
在运行的mongod
或mongos
上配置此设置。
Starting in MongoDB 4.4, the 从MongoDB 4.4开始,ldapQueryPassword
setParameter
command accepts either a string or an array of strings. ldapQueryPassword
setParameter
命令接受字符串或字符串数组。If 如果ldapQueryPassword
is set to an array, MongoDB tries each password in order until one succeeds. ldapQueryPassword
设置为数组,MongoDB会按顺序尝试每个密码,直到一个密码成功。Use a password array to roll over the LDAP account password without downtime.使用密码数组在不停机的情况下滚动LDAP帐户密码。
Windows MongoDB deployments can use Windows MongoDB部署可以使用useOSDefaults
instead of queryUser
and queryPassword
. useOSDefaults
而不是queryUser
和queryPassword
。You cannot specify both 不能同时指定queryPassword
and useOSDefaults
at the same time.queryPassword
和useOSDefaults
。
security.ldap.bind.useOSDefaults
Type类型: boolean
Default默认值: false
Available in MongoDB Enterprise for the Windows platform only.MongoDB Enterprise中仅适用于Windows平台。
Allows 允许mongod
or mongos
to authenticate, or bind, using your Windows login credentials when connecting to the LDAP server.mongod
或mongos
在连接到LDAP服务器时使用Windows登录凭据进行身份验证或绑定。
Only required if:仅在以下情况下需要:
username transformation
.Use 使用useOSDefaults
to replace queryUser
and queryPassword
.useOSDefaults
替换queryUser
和queryPassword
。
security.ldap.bind.method
Type类型: string
Default默认值: simple
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
The method mongod
or mongos
uses to authenticate to an LDAP server. mongod
或mongos
用于向LDAP服务器进行身份验证的方法。Use with 与queryUser
and queryPassword
to connect to the LDAP server.queryUser
和queryPassword
一起使用可连接到LDAP服务器。
method
supports the following values:支持以下值:
simple
- mongod
mongos
sasl
- mongod
mongos
If you specify 如果指定sasl
, you can configure the available SASL mechanisms using security.ldap.bind.saslMechanisms
. sasl
,则可以使用security.ldap.bind.saslMechanisms
配置可用的sasl机制。mongod
or mongos
defaults to using DIGEST-MD5
mechanism.mongod
或mongos
默认使用DIGEST-MD5
机制。
security.ldap.bind.saslMechanisms
Type类型: string
Default默认值: DIGEST-MD5
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
A comma-separated list of SASL mechanisms mongod
or mongos
can use when authenticating to the LDAP server. mongod
或mongos
在对LDAP服务器进行身份验证时可以使用的以逗号分隔的SASL机制列表。The mongod
or mongos
and the LDAP server must agree on at least one mechanism. mongod
或mongos
和LDAP服务器必须至少就一种机制达成一致。The mongod
or mongos
dynamically loads any SASL mechanism libraries installed on the host machine at runtime.mongod
或mongos
在运行时动态加载主机上安装的任何SASL机制库。
Install and configure the appropriate libraries for the selected SASL mechanism(s) on both the 在mongod
or mongos
host and the remote LDAP server host. mongod
或mongos
主机以及远程LDAP服务器主机上为所选SASL机制安装并配置适当的库。Your operating system may include certain SASL libraries by default. 默认情况下,您的操作系统可能包括某些SASL库。Defer to the documentation associated with each SASL mechanism for guidance on installation and configuration.遵循与每个SASL机制相关的文档,获取安装和配置指南。
If using the 如果将GSSAPI SASL机制用于Kerberos身份验证,请验证GSSAPI
SASL mechanism for use with Kerberos Authentication, verify the following for the mongod
or mongos
host machine:mongod
或mongos
主机的以下内容:
Linux
KRB5_CLIENT_KTNAME
environment variable resolves to the name of the client Linux Keytab Files for the host machine. KRB5_CLIENT_KTNAME
环境变量解析为主机的客户机Linux Keytab文件的名称。mongod
or mongos
to use when connecting to the LDAP server and execute LDAP queries.mongod
或mongos
在连接到LDAP服务器并执行LDAP查询时使用。Windows
useOSDefaults
to true
to allow mongod
or mongos
to use the generated credentials when connecting to the Active Directory server and execute queries.useOSDefaults
设置为true
,以允许mongod
或mongos
在连接到活动目录服务器并执行查询时使用生成的凭据。Set 将method
to sasl
to use this option.method
设置为sasl
以使用此选项。
For a complete list of SASL mechanisms see the IANA listing. 有关SASL机制的完整列表,请参阅IANA列表。Defer to the documentation for your LDAP or Active Directory service for identifying the SASL mechanisms compatible with the service.按照LDAP或活动目录服务的文档来确定与该服务兼容的SASL机制。
MongoDB is not a source of SASL mechanism libraries, nor is the MongoDB documentation a definitive source for installing or configuring any given SASL mechanism. MongoDB不是SASL机制库的来源,MongoDB文档也不是安装或配置任何给定SASL机制的最终来源。For documentation and support, defer to the SASL mechanism library vendor or owner.有关文档和支持,请咨询SASL机制库供应商或所有者。
For more information on SASL, defer to the following resources:有关SASL的更多信息,请参阅以下参考资料:
security.ldap.transportSecurity
Type类型: string
Default默认值: tls
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
By default, 默认情况下,mongod
or mongos
creates a TLS/SSL secured connection to the LDAP server.mongod
或mongos
会创建到LDAP服务器的TLS/SSL安全连接。
For Linux deployments, you must configure the appropriate TLS Options in 对于Linux部署,必须在/etc/openldap/ldap.conf
file. /etc/openldap/ldap.conf
文件中配置适当的TLS选项。Your operating system's package manager creates this file as part of the MongoDB Enterprise installation, via the 作为MongoDB Enterprise安装的一部分,操作系统的包管理器通过libldap
dependency. libldap
依赖项创建此文件。See the documentation for 有关更完整的说明,请参阅ldap.conf OpenLDAP文档中有关TLS Options
in the ldap.conf OpenLDAP documentation for more complete instructions.TLS
选项的文档。
For Windows deployment, you must add the LDAP server CA certificates to the Windows certificate management tool. 对于Windows部署,必须将LDAP服务器CA证书添加到Windows证书管理工具。The exact name and functionality of the tool may vary depending on operating system version. 工具的确切名称和功能可能因操作系统版本而异。Please see the documentation for your version of Windows for more information on certificate management.有关证书管理的更多信息,请参阅Windows版本的文档。
Set 将transportSecurity
to none
to disable TLS/SSL between mongod
or mongos
and the LDAP server.transportSecurity
设置为none以禁用mongod
或mongos
与LDAP服务器之间的TLS/SSL。
Setting 将transportSecurity
to none
transmits plaintext information and possibly credentials between mongod
or mongos
and the LDAP server.transportSecurity
设置为none
可在mongod
或mongos
与LDAP服务器之间传输明文信息和可能的凭据。
security.ldap.timeoutMS
Type类型: int
Default默认值: 10000
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
The amount of time in milliseconds mongod
or mongos
should wait for an LDAP server to respond to a request.mongod
或mongos
等待LDAP服务器响应请求的时间(毫秒)。
Increasing the value of 如果故障源是连接超时,增加timeoutMS
may prevent connection failure between the MongoDB server and the LDAP server, if the source of the failure is a connection timeout. timeoutMS
的值可以防止MongoDB服务器和LDAP服务器之间的连接失败。Decreasing the value of 减少timeoutMS
reduces the time MongoDB waits for a response from the LDAP server.timeoutMS
的值可以减少MongoDB等待LDAP服务器响应的时间。
This setting can be configured on a running 可以使用mongod
or mongos
using setParameter
.setParameter
在运行的mongod
或mongos
上配置此设置。
security.ldap.userToDNMapping
Type类型: string
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
Maps the username provided to 将提供给mongod
or mongos
for authentication to a LDAP Distinguished Name (DN). mongod
或mongos
进行身份验证的用户名映射到LDAP可分辨名称(DN)。You may need to use 在以下情况下,您可能需要使用userToDNMapping
to transform a username into an LDAP DN in the following scenarios:userToDNMapping
将用户名转换为LDAP DN:
LDAP authorization query template
that requires a DN.userToDNMapping
expects a quote-enclosed JSON-string representing an ordered array of documents. 需要一个引号内的JSON字符串,表示文档的有序数组。Each document contains a regular expression 每个文档都包含一个正则表达式match
and either a substitution
or ldapQuery
template used for transforming the incoming username.match
,以及用于转换传入用户名的substitution
或ldapQuery
模板。
Each document in the array has the following form:数组中的每个文档都有以下格式:
{ match: "<regex>" substitution: "<LDAP DN>" | ldapQuery: "<LDAP Query>" }
match | substitution or ldapQuery .substitution 或ldapQuery 使用的正则表达式捕获组。
| "(.+)ENGINEERING" "(.+)DBA"
|
substitution |
| "cn={0},ou=engineering, dc=example,dc=com"
|
ldapQuery | match regex into an LDAP query URI encoded respecting RFC4515 and RFC4516. match 正则表达式匹配的身份验证名称插入按照RFC4515和RFC4516编码的LDAP查询URI中。match expression. match 表达式从身份验证用户名中提取的相应正则表达式捕获组替换。mongod mongos mongod or mongos requires exactly one returned result for the transformation to be successful, or mongod or mongos skips this transformation.mongod 或mongos 要求只有一个返回的结果,转换才能成功,或者mongod 或mongos 跳过此转换。 | "ou=engineering,dc=example, dc=com??one?(user={0})"
|
For each document in the array, you must use either 对于数组中的每个文档,必须使用substitution
or ldapQuery
. substitution
或ldapQuery
。You cannot specify both in the same document.不能在同一文档中同时指定两者。
When performing authentication or authorization, 在执行身份验证或授权时,mongod
or mongos
steps through each document in the array in the given order, checking the authentication username against the match
filter. mongod
或mongos
会按给定顺序遍历数组中的每个文档,根据match
筛选器检查身份验证用户名。 If a match is found, 如果找到匹配项,mongod
or mongos
applies the transformation and uses the output for authenticating the user. mongod
或mongos
将应用转换并使用输出对用户进行身份验证。mongod
or mongos
does not check the remaining documents in the array.mongod
或mongos
不会检查数组中的剩余文档。
If the given document does not match the provided authentication name, 如果给定的文档与提供的身份验证名称不匹配,mongod
or mongos
continues through the list of documents to find additional matches. mongod
或mongos
将继续查看文档列表以查找其他匹配项。If no matches are found in any document, or the transformation the document describes fails, 如果在任何文档中都没有找到匹配项,或者文档描述的转换失败,mongod
or mongos
returns an error.mongod
或mongos
将返回一个错误。
Starting in MongoDB 4.4, 从MongoDB 4.4开始,如果由于LDAP服务器的联网或身份验证失败而无法评估其中一个转换,mongod
or mongos
also returns an error if one of the transformations cannot be evaluated due to networking or authentication failures to the LDAP server. mongod
或mongos
也会返回一个错误。mongod
or mongos
rejects the connection request and does not check the remaining documents in the array.mongod
或mongos
拒绝连接请求,不检查数组中的其余文档。
Starting in MongoDB 5.0, 从MongoDB 5.0开始,userToDNMapping
accepts an empty string ""
or empty array [ ]
in place of a mapping documnent. userToDNMapping
接受空字符串""
或空数组[]
来代替映射文档。If providing an empty string or empty array to 如果向userToDNMapping
, MongoDB will map the authenticated username as the LDAP DN. userToDNMapping
提供空字符串或空数组,MongoDB会将经过身份验证的用户名映射为LDAP DN。Previously, providing an empty mapping document would cause mapping to fail.以前,提供空映射文档会导致映射失败。
The following shows two transformation documents. 下面显示了两个转换文档。The first document matches against any string ending in 第一个文档匹配以@ENGINEERING
, placing anything preceeding the suffix into a regex capture group. @ENGINEERING
结尾的任何字符串,将后缀之前的任何内容放入正则表达式捕获组。The second document matches against any string ending in 第二个文档匹配以@DBA
, placing anything preceeding the suffix into a regex capture group.@DBA
结尾的任何字符串,将后缀之前的任何内容放入正则表达式捕获组。
"[ { match: "(.+)@ENGINEERING.EXAMPLE.COM", substitution: "cn={0},ou=engineering,dc=example,dc=com" }, { match: "(.+)@DBA.EXAMPLE.COM", ldapQuery: "ou=dba,dc=example,dc=com??one?(user={0})" } ]"
A user with username 具有用户名alice@ENGINEERING.EXAMPLE.COM
matches the first document. alice@ENGINEERING.EXAMPLE.COM
的用户匹配第一个文档。The regex capture group 正则表达式捕获组{0}
corresponds to the string alice
. {0}
对应于字符串alice
。The resulting output is the DN 结果输出是DN"cn=alice,ou=engineering,dc=example,dc=com"
."cn=alice,ou=engineering,dc=example,dc=com"
。
A user with username 具有用户名bob@DBA.EXAMPLE.COM
matches the second document. bob@DBA.EXAMPLE.COM
的用户匹配第二个文档。The regex capture group 正则表达式捕获组{0}
corresponds to the string bob
. {0}
对应于字符串bob
。The resulting output is the LDAP query 结果输出是LDAP查询"ou=dba,dc=example,dc=com??one?(user=bob)"
. "ou=dba,dc=example,dc=com??one?(user=bob)"
。mongod
or mongos
executes this query against the LDAP server, returning the result "cn=bob,ou=dba,dc=example,dc=com"
.mongod
或mongos
对LDAP服务器执行此查询,返回结果"cn=bob,ou=dba,dc=example,dc=com"
。
If 如果userToDNMapping
is unset, mongod
or mongos
applies no transformations to the username when attempting to authenticate or authorize a user against the LDAP server.userToDNMapping
未设置,则mongod
或mongos
在尝试针对LDAP服务器对用户进行身份验证或授权时,不会对用户名应用任何转换。
This setting can be configured on a running 可以使用mongod
or mongos
using the setParameter
database command.setParameter
数据库命令在运行的mongod
或mongos
上配置此设置。
security.ldap.authz.queryTemplate
Type类型: string
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
A relative LDAP query URL formatted conforming to RFC4515 and RFC4516 that 按照RFC4515和RFC4515格式化的相对LDAP查询URL,mongod
executes to obtain the LDAP groups to which the authenticated user belongs to. mongod
执行该URL以获得认证用户所属的LDAP组。The query is relative to the host or hosts specified in 查询与security.ldap.servers
.security.ldap.servers
中指定的主机相关。
In the URL, you can use the following substitution tokens:在URL中,可以使用以下替换标记:
{USER} | transformed username if a userToDNMapping is specified.userToDNMapping ,则替换转换后的用户名。
|
{PROVIDED_USER} |
|
When constructing the query URL, ensure that the order of LDAP parameters respects RFC4516:构造查询URL时,请确保LDAP参数的顺序符合RFC4516:
[ dn [ ? [attributes] [ ? [scope] [ ? [filter] [ ? [Extensions] ] ] ] ] ]
If your query includes an attribute, 如果您的查询包含一个属性,mongod
assumes that the query retrieves a list of the DNs which this entity is a member of.mongod
假设该查询检索该实体所属的DNs列表。
If your query does not include an attribute, 如果您的查询不包含属性,mongod
assumes the query retrieves all entities which the user is member of.mongod
将假定该查询检索用户所属的所有实体。
For each LDAP DN returned by the query, 对于查询返回的每个LDAP DN,mongod
assigns the authorized user a corresponding role on the admin
database. mongod
在admin
数据库中为授权用户分配相应的角色。If a role on the on the 如果admin数据库上的角色与DN完全匹配,admin
database exactly matches the DN, mongod
grants the user the roles and privileges assigned to that role. mongod
将向用户授予分配给该角色的角色和权限。See the 有关创建角色的详细信息,请参阅db.createRole()
method for more information on creating roles.db.createRole()
方法。
This LDAP query returns any groups listed in the LDAP user object's 此LDAP查询返回LDAP用户对象的memberOf
attribute.memberOf
属性中列出的任何组。
"{USER}?memberOf?base"
Your LDAP configuration may not include the LDAP配置可能不包括memberOf
attribute as part of the user schema, may possess a different attribute for reporting group membership, or may not track group membership through attributes. memberOf
属性作为用户架构的一部分,可能具有报告组成员身份的不同属性,或者可能不通过属性跟踪组成员身份。Configure your query with respect to your own unique LDAP configuration.根据自己独特的LDAP配置配置查询。
If unset, 如果未设置,mongod
cannot authorize users using LDAP.mongod
将无法授权用户使用LDAP。
This setting can be configured on a running 可以使用mongod
using the setParameter
database command.setParameter
数据库命令在运行的mongod
上配置此设置。
security.ldap.validateLDAPServerConfig
Type类型: boolean
Default默认值: true
Available in MongoDB Enterprise在MongoDB Enterprise中提供
A flag that determines if the 一个标志,用于确定mongod
or mongos
instance checks the availability of the LDAP server(s)
as part of its startup:mongod
或mongos
实例是否在启动时检查LDAP服务器的可用性:
true
, the mongod
or mongos
instance performs the availability check and only continues to start up if the LDAP server is available.true
,mongod
或mongos
实例将执行可用性检查,并且只有在LDAP服务器可用时才会继续启动。false
, the mongod
or mongos
instance skips the availability check; i.e. the instance starts up even if the LDAP server is unavailable.false
,mongod
或mongos
实例将跳过可用性检查;即使LDAP服务器不可用,实例也会启动。setParameter
OptionsetParameter
Set MongoDB parameter or parameters described in MongoDB Server Parameters设置MongoDB参数或MongoDB服务器参数中描述的参数
To set parameters in the YAML configuration file, use the following format:要在YAML配置文件中设置参数,请使用以下格式:
setParameter: <parameter1>: <value1> <parameter2>: <value2>
For example, to specify the enableLocalhostAuthBypass
in the configuration file:
setParameter: enableLocalhostAuthBypass: false
setParameter.ldapUserCacheInvalidationInterval
Type类型: int
Default默认值: 30
For use with 用于使用LDAP授权的mongod
servers using LDAP Authorization.mongod
服务器。
The interval (in seconds) mongod
waits between external user cache flushes. mongod
在外部用户缓存刷新之间等待的时间间隔(秒)。After mongod
flushes the external user cache, MongoDB reacquires authorization data from the LDAP server the next time an LDAP-authorized user issues an operation.mongod
刷新外部用户缓存后,下次LDAP授权用户发出操作时,MongoDB将从LDAP服务器重新获取授权数据。
Increasing the value specified increases the amount of time 增加指定的值会增加mongod
and the LDAP server can be out of sync, but reduces the load on the LDAP server. mongod
和LDAP服务器可能不同步的时间,但会减少LDAP服务器上的负载。Conversely, decreasing the value specified decreases the time 相反,减少指定的值会减少mongod
and the LDAP server can be out of sync while increasing the load on the LDAP server.mongod
和LDAP服务器可能不同步的时间,同时增加LDAP服务器上的负载。
setParameter: ldapUserCacheInvalidationInterval: <int>
storage
Changed in version 4.4.在版本4.4中更改。
storage.indexBuildRetry
option and the corresponding --noIndexBuildRetry
command-line option.storage.indexBuildRetry
选项和相应的--noIndexBuilderMetry
命令行选项。storage.wiredTiger.engineConfig.maxCacheOverflowFileSizeGB
option. storage.wiredTiger.engineConfig.maxCacheOverflowFileSizeGB
选项。storage: dbPath: <string> journal: enabled: <boolean> commitIntervalMs: <num> directoryPerDB: <boolean> syncPeriodSecs: <int> engine: <string> wiredTiger: engineConfig: cacheSizeGB: <number> journalCompressor: <string> directoryForIndexes: <boolean> maxCacheOverflowFileSizeGB: <number> // deprecated in MongoDB 4.4 collectionConfig: blockCompressor: <string> indexConfig: prefixCompression: <boolean> inMemory: engineConfig: inMemorySizeGB: <number> oplogMinRetentionHours: <double>
storage.dbPath
Type类型: string
Default默认值:
/data/db
\data\db
The directory where the mongod
instance stores its data.mongod
实例存储其数据的目录。
The storage.dbPath
setting is available only for mongod
.storage.dbPath
设置仅适用于mongod
。
The default 包管理器安装附带的默认mongod.conf
configuration file included with package manager installations uses the following platform-specific default values for storage.dbPath
:mongod.conf
配置文件使用以下特定于平台的storage.dbPath
默认值:
Platform | Package Manager | Default storage.dbPath |
---|---|---|
RHEL / CentOS and Amazon | yum | /var/lib/mongo |
SUSE | zypper | /var/lib/mongo |
Ubuntu and Debian | apt | /var/lib/mongodb |
macOS | brew | /usr/local/var/mongodb |
The Linux package init scripts do not expect Linux包初始化脚本不希望storage.dbPath
to change from the defaults. storage.dbPath
更改默认值。If you use the Linux packages and change 如果使用Linux软件包并更改storage.dbPath
, you will have to use your own init scripts and disable the built-in scripts.storage.dbPath
,则必须使用自己的初始化脚本并禁用内置脚本。
storage.journal.enabled
Type类型: boolean
Default默认值: :64位系统为true
on 64-bit systems, false
on 32-bit systemstrue
,32位系统为false
Enable or disable the durability journal to ensure data files remain valid and recoverable. 启用或禁用耐久性日志以确保数据文件保持有效和可恢复。This option applies only when you specify the 此选项仅在指定storage.dbPath
setting. storage.dbPath
设置时适用。mongod
enables journaling by default.默认情况下启用日志记录。
The storage.journal.enabled
setting is available only for mongod
.storage.journal.enabled
设置仅适用于mongod
。
Not available for 不适用于使用内存存储引擎的mongod
instances that use the in-memory storage engine.mongod
实例。
Starting in MongoDB 4.0, you cannot specify 从MongoDB 4.0开始,您不能为使用WiredTiger存储引擎的副本集成员指定--nojournal
option or storage.journal.enabled: false
for replica set members that use the WiredTiger storage engine.--nojournal
选项或storage.journal.enabled: false
。
storage.journal.commitIntervalMs
Type类型: number
Default默认值: 100
The maximum amount of time in milliseconds that the mongod
process allows between journal operations. mongod
进程在日志操作之间允许的最大时间(毫秒)。Values can range from 1 to 500 milliseconds. 值的范围为1到500毫秒。Lower values increase the durability of the journal, at the expense of disk performance.较低的值会增加日志的持久性,但会牺牲磁盘性能。
On WiredTiger, the default journal commit interval is 100 milliseconds. 在WiredTiger上,默认日志提交间隔为100毫秒。Additionally, a write that includes or implies 此外,包含或暗示j:true
will cause an immediate sync of the journal. j:true
的写入将导致日志立即同步。For details or additional conditions that affect the frequency of the sync, see Journaling Process.有关影响同步频率的详细信息或其他条件,请参阅日志记录过程。
The storage.journal.commitIntervalMs
setting is available only for mongod
.storage.journal.commitIntervalMs
设置仅适用于mongod
。
Not available for 不适用于使用内存存储引擎的mongod
instances that use the in-memory storage engine.mongod
实例。
Known Issue in 4.2.0: The 4.2.0中的已知问题:storage.journal.commitIntervalMs
is missing in 4.2.0.storage.journal.commitIntervalMs
在4.2.0中缺失。
storage.directoryPerDB
Type类型: boolean
Default默认值: false
When 如果为true
, MongoDB uses a separate directory to store data for each database. true
,MongoDB将使用单独的目录存储每个数据库的数据。The directories are under the 这些目录位于storage.dbPath
directory, and each subdirectory name corresponds to the database name.storage.dbPath
目录下,每个子目录名都对应于数据库名。
The storage.directoryPerDB
setting is available only for mongod
.storage.directoryPerDB
设置仅适用于mongod
。
Not available for 不适用于使用内存存储引擎的mongod
instances that use the in-memory storage engine.mongod
实例。
Starting in MongoDB 5.0, dropping the final collection in a database (or dropping the database itself) when 从MongoDB 5.0开始,在启用storage.directoryPerDB
is enabled deletes the newly empty subdirectory for that database.storage.directoryPerDB
时删除数据库中的最终集合(或删除数据库本身),会删除该数据库新的空子目录。
To change the 要更改现有部署的storage.directoryPerDB
option for existing deployments:storage.directoryPerDB
选项,请执行以下操作:
For standalone instances:对于独立实例:
mongodump
on the existing mongod
instance to generate a backup.mongod
实例上使用mongodump
生成备份。mongod
instance.mongod
实例。storage.directoryPerDB
value andconfigure a new data directorystorage.directoryPerDB
值并配置新的数据目录mongod
instance.mongod
实例。mongorestore
to populate the new data directory.mongorestore
填充新的数据目录。For replica sets:对于副本集:
secondary
成员。storage.directoryPerDB
value andconfigure a new data directory to that secondary member.storage.directoryPerDB
值,并为该secondary
成员配置一个新的数据目录。storage.syncPeriodSecs
Type类型: number
Default默认值: 60
The amount of time that can pass before MongoDB flushes data to the data files via an fsync operation.MongoDB通过fsync操作将数据刷新到数据文件之前可以经过的时间量。
Do not set this value on production systems.不要在生产系统上设置此值。 In almost every situation, you should use the default setting.在几乎所有情况下,都应该使用默认设置。
If you set 如果将storage.syncPeriodSecs
to 0
, MongoDB will not sync the memory mapped files to disk.storage.syncPeriodSecs
设置为0
,MongoDB将不会将内存映射文件同步到磁盘。
The mongod
process writes data very quickly to the journal and lazily to the data files. mongod
进程非常快速地将数据写入日志,并缓慢地写入数据文件。storage.syncPeriodSecs
has no effect on the journal
files or journaling, but if storage.syncPeriodSecs
is set to 0
the journal will eventually consume all available disk space. storage.syncPeriodSecs
对journal
文件或日志记录没有影响,但如果storage.syncPeriodSecs
设置为0,则日志最终将消耗所有可用磁盘空间。If you set 如果出于测试目的将storage.syncPeriodSecs
to 0
for testing purposes, you should also set --nojournal
to true
.storage.syncPeriodSecs
设置为0,则还应将--nojournal
设置为true
。
The storage.syncPeriodSecs
setting is available only for mongod
.storage.syncPeriodSecs
设置仅适用于mongod
。
Not available for 不适用于使用内存存储引擎的mongod
instances that use the in-memory storage engine.mongod
实例。
storage.engine
Default默认值: wiredTiger
Starting in version 4.2, MongoDB removes the deprecated MMAPv1 storage engine.从4.2版开始,MongoDB删除了不推荐使用的MMAPv1存储引擎。
The storage engine for the mongod
database. mongod
数据库的存储引擎。Available values include:可用值包括:
wiredTiger | |
inMemory | To specify the In-Memory Storage Engine.
If you attempt to start a |
storage.oplogMinRetentionHours
Type类型: double
New in version 4.4.在版本4.4中新增。 Specifies the minimum number of hours to preserve an oplog entry, where the decimal values represent the fractions of an hour. 指定保留oplog条目的最小小时数,其中十进制值表示小时的小数点。For example, a value of 例如,值1.5
represents one hour and thirty minutes.1.5
表示一小时三十分钟。
The value must be greater than or equal to 该值必须大于或等于0
. 0
。A value of 值为0
indicates that the mongod
should truncate the oplog starting with the oldest entries to maintain the configured maximum oplog size.0
表示mongod
应该从最旧的条目开始截断oplog,以保持配置的最大oplog大小。
Defaults to 默认值为0
.0
。
A 以mongod
started with oplogMinRetentionHours
only removes an oplog entry if:oplogMinRetentionHours
启动的mongod
仅在以下情况下删除oplog条目:
The 当配置了最短的oplog保留期时,mongod
has the following behavior when configured with a minimum oplog retention period:mongod
具有以下行为:
mongod
may continue to hold that disk space even if the oplog returns to its maximum size or is configured for a smaller maximum size. mongod
也可以继续保留该磁盘空间。mongod
compares the system wall clock to an oplog entries creation wall clock time when enforcing oplog entry retention. mongod
会在执行oplog条目保留时,将系统挂钟与oplog条目创建挂钟时间进行比较。To change the minimum oplog retention period after starting the 要在启动mongod
, use replSetResizeOplog
. mongod
后更改最短oplog保留期,请使用replSetResizeOplog
。replSetResizeOplog
enables you to resize the oplog dynamically without restarting the 使您能够在不重新启动mongod
process. mongod
进程的情况下动态调整oplog的大小。To persist the changes made using 要通过重新启动来持久化使用replSetResizeOplog
through a restart, update the value of oplogMinRetentionHours
.replSetResizeOplog
所做的更改,请更新oplogMinRetentionHours
的值。
storage.wiredTiger
storage: wiredTiger: engineConfig: cacheSizeGB: <number> journalCompressor: <string> directoryForIndexes: <boolean> maxCacheOverflowFileSizeGB: <number> // Deprecated in MongoDB 4.4 collectionConfig: blockCompressor: <string> indexConfig: prefixCompression: <boolean>
storage.wiredTiger.engineConfig.cacheSizeGB
Type类型: float
Defines the maximum size of the internal cache that WiredTiger will use for all data. 定义WiredTiger将用于所有数据的内部缓存的最大大小。The memory consumed by an index build (see 索引生成所消耗的内存(请参阅maxIndexBuildMemoryUsageMegabytes
) is separate from the WiredTiger cache memory.maxIndexBuildMemoryUsageMegabytes
)与WiredTiger缓存内存是分开的。
Values can range from 值的范围从0.25
GB to 10000
GB.0.25
GB到10000
GB。
Starting in MongoDB 3.4, the default WiredTiger internal cache size is the larger of either:从MongoDB 3.4开始,默认WiredTiger内部缓存大小为以下两个值中的较大值:
For example, on a system with a total of 4GB of RAM the WiredTiger cache will use 1.5GB of RAM (例如,在总内存为4GB的系统上,WiredTiger缓存将使用1.5GB的RAM(0.5 * (4 GB - 1 GB) = 1.5 GB
). 0.5 * (4 GB - 1 GB) = 1.5 GB
)。Conversely, a system with a total of 1.25 GB of RAM will allocate 256 MB to the WiredTiger cache because that is more than half of the total RAM minus one gigabyte (相反,总RAM为1.25 GB的系统将向WiredTiger缓存分配256 MB,因为这是总RAM减去1 GB(0.5 * (1.25 GB - 1 GB) = 128 MB < 256 MB
).0.5 * (1.25 GB - 1 GB) = 128 MB < 256 MB
)的一半以上。
In some instances, such as when running in a container, the database can have memory constraints that are lower than the total system memory. 在某些情况下,例如在容器中运行时,数据库的内存约束可能低于系统总内存。In such instances, this memory limit, rather than the total system memory, is used as the maximum RAM available.在这种情况下,这个内存限制,而不是总的系统内存,被用作可用的最大RAM。
To see the memory limit, see 要查看内存限制,请参阅hostInfo.system.memLimitMB
.hostInfo.system.memLimitMB
。
Avoid increasing the WiredTiger internal cache size above its default value.避免将WiredTiger内部缓存大小增加到其默认值以上。
With WiredTiger, MongoDB utilizes both the WiredTiger internal cache and the filesystem cache.对于WiredTiger,MongoDB利用WiredTiger内部缓存和文件系统缓存。
Via the filesystem cache, MongoDB automatically uses all free memory that is not used by the WiredTiger cache or by other processes.通过文件系统缓存,MongoDB自动使用WiredTiger缓存或其他进程未使用的所有可用内存。
The storage.wiredTiger.engineConfig.cacheSizeGB
limits the size of the WiredTiger internal cache. storage.wiredTiger.engineConfig.cacheSizeGB
限制WiredTiger内部缓存的大小。The operating system will use the available free memory for filesystem cache, which allows the compressed MongoDB data files to stay in memory. 操作系统将使用可用的空闲内存进行文件系统缓存,从而允许压缩的MongoDB数据文件留在内存中。In addition, the operating system will use any free RAM to buffer file system blocks and file system cache.此外,操作系统将使用任何可用RAM来缓冲文件系统块和文件系统缓存。
To accommodate the additional consumers of RAM, you may have to decrease WiredTiger internal cache size.为了适应RAM的额外消耗,您可能必须减小WiredTiger内部缓存的大小。
The default WiredTiger internal cache size value assumes that there is a single 默认的WiredTiger内部缓存大小值假定每台机器有一个mongod
instance per machine. mongod
实例。If a single machine contains multiple MongoDB instances, then you should decrease the setting to accommodate the other 如果一台机器包含多个MongoDB实例,则应减少设置以适应其他MongoDB实例。mongod
instances.
If you run 如果在无法访问系统中所有可用RAM的容器(如mongod
in a container (e.g. lxc
, cgroups
, Docker, etc.) that does not have access to all of the RAM available in a system, you must set storage.wiredTiger.engineConfig.cacheSizeGB
to a value less than the amount of RAM available in the container. lxc
、cgroups
、Docker等)中运行mongod
,则必须将storage.wiredTiger.engineConfig.cacheSizeGB
设置为小于容器中可用RAM数量的值。The exact amount depends on the other processes running in the container. 具体数量取决于容器中运行的其他进程。See 请参阅memLimitMB
.memLimitMB
。
storage.wiredTiger.engineConfig.journalCompressor
Default默认值: snappy
Specifies the type of compression to use to compress WiredTiger journal data.指定用于压缩WiredTiger日志数据的压缩类型。
Available compressors are:可用的压缩机有:
storage.wiredTiger.engineConfig.directoryForIndexes
Type类型: boolean
Default默认值: false
When 当storage.wiredTiger.engineConfig.directoryForIndexes
is true
, mongod
stores indexes and collections in separate subdirectories under the data (i.e. storage.dbPath
) directory. storage.wiredTiger.engineConfig.directoryForIndexes
为true
时,mongod
将索引和集合存储在数据(即storage.dbPath
)目录下的单独子目录中。Specifically, 具体来说,mongod
stores the indexes in a subdirectory named index
and the collection data in a subdirectory named collection
.mongod
将索引存储在名为index
的子目录中,将集合数据存储在名为collection的子目录中。
By using a symbolic link, you can specify a different location for the indexes. 通过使用符号链接,可以为索引指定不同的位置。Specifically, when 具体来说,当mongod
instance is notrunning, move the index
subdirectory to the destination and create a symbolic link named index
under the data directory to the new destination.mongod
实例未运行时,将index
子目录移动到目标,并在数据目录下创建一个名为index
的符号链接到新的目标。
storage.wiredTiger.engineConfig.maxCacheOverflowFileSizeGB
Type类型: float
MongoDB deprecates the MongoDB不推荐storage.wiredTiger.engineConfig.maxCacheOverflowFileSizeGB
option. storage.wiredTiger.engineConfig.maxCacheOverflowFileSizeGB
选项。The option has no effect starting in MongoDB 4.4.从MongoDB 4.4开始,该选项无效。
Specifies 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 setting 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 。 |
To change the maximum size during runtime, use the 要在运行时更改最大大小,请使用wiredTigerMaxCacheOverflowSizeGB
parameter.wiredTigerMaxCacheOverflowSizeGB
参数。
Available starting in MongoDB 4.2.1 (and 4.0.12)从MongoDB 4.2.1(和4.0.12)开始提供
storage.wiredTiger.engineConfig.zstdCompressionLevel
Type类型: integer
Default默认值: 6
Specifies the level of compression applied when using the zstd compressor.指定使用zstd压缩器时应用的压缩级别。
Values can range from 1 to 22.值的范围从1到22。
The higher the specified value for zstdCompressionLevel
the higher the compression which is applied.zstdCompressionLevel
的指定值越高,应用的压缩越高。
Only applicable when blockCompressor
is set to zstd
.
Available starting in MongoDB 5.0从MongoDB 5.0开始提供
storage.wiredTiger.collectionConfig.blockCompressor
Default默认值: snappy
Specifies the default compression for collection data. 指定集合数据的默认压缩。You can override this on a per-collection basis when creating collections.在创建集合时,可以基于每个集合覆盖此选项。
Available compressors are:可用的压缩机有:
storage.wiredTiger.collectionConfig.blockCompressor
affects all collections created. 影响创建的所有集合。If you change the value of 如果在现有MongoDB部署上更改storage.wiredTiger.collectionConfig.blockCompressor
on an existing MongoDB deployment, all new collections will use the specified compressor. storage.wiredTiger.collectionConfig.blockCompressor
的值,则所有新集合都将使用指定的压缩器。Existing collections will continue to use the compressor specified when they were created, or the default compressor at that time.现有集合将继续使用创建时指定的压缩器,或使用当时的默认压缩器。
storage.wiredTiger.indexConfig.prefixCompression
Default默认值: true
Enables or disables prefix compression for index data.启用或禁用索引数据的前缀压缩。
Specify 为true
for storage.wiredTiger.indexConfig.prefixCompression
to enable prefix compression for index data, or false
to disable prefix compression for index data.storage.wiredTiger.indexConfig.prefixCompression
指定true
以启用索引数据的前缀压缩,或为false
以禁用索引数据的前缀压缩。
The storage.wiredTiger.indexConfig.prefixCompression
setting affects all indexes created. storage.wiredTiger.indexConfig.prefixCompression
设置会影响创建的所有索引。If you change the value of 如果在现有MongoDB部署上更改storage.wiredTiger.indexConfig.prefixCompression
on an existing MongoDB deployment, all new indexes will use prefix compression. storage.wiredTiger.indexConfig.prefixCompression
的值,所有新索引都将使用前缀压缩。Existing indexes are not affected.现有索引不受影响。
storage.inmemory
storage: inMemory: engineConfig: inMemorySizeGB: <number>
storage.inMemory.engineConfig.inMemorySizeGB
Type类型: float
Default默认值: 50% of physical RAM less 1 GB:50%的物理RAM小于1 GB
Changed in version 3.4.在版本3.4中更改。
Maximum amount of memory to allocate for in-memory storage engine data, including indexes, oplog if the 为内存中存储引擎数据分配的最大内存量,包括索引、oplog(如果mongod
is part of replica set, replica set or sharded cluster metadata, etc.mongod
是副本集、副本集或分片群集元数据的一部分),等等。
By default, the in-memory storage engine uses 50% of physical RAM minus 1 GB.默认情况下,内存存储引擎使用50%的物理RAM减去1 GB。
Available in MongoDB Enterprise only.仅在MongoDB Enterprise中提供。
operationProfiling
operationProfiling: mode: <string> slowOpThresholdMs: <int> slowOpSampleRate: <double> filter: <string>
operationProfiling.mode
Type类型: string
Default默认值: off
Specifies which operations should be profiled. 指定应分析哪些操作。The following profiler levels are available:以下探查器级别可用:
Level | |
---|---|
off | |
slowOp | slowms .slowms 值的操作集合数据。 |
all |
Profiling can impact performance and shares settings with the system log. 分析可能会影响性能,并与系统日志共享设置。Carefully consider any performance and security implications before configuring and enabling the profiler on a production deployment.在生产部署中配置和启用剖析器之前,仔细考虑任何性能和安全含义。
See Profiler Overhead for more information on potential performance degradation.有关潜在性能下降的更多信息,请参阅探查器开销。
operationProfiling.slowOpThresholdMs
Type类型: integer
Default默认值: 100
The slow operation time threshold, in milliseconds. 慢速操作时间阈值,以毫秒为单位。Operations that run for longer than this threshold are considered slow.运行时间超过此阈值的操作被认为是缓慢的。
When 当logLevel
is set to 0
, MongoDB records slowoperations to the diagnostic log at a rate determined by slowOpSampleRate
.logLevel
设置为0
时,MongoDB将以slowOpSampleRate
确定的速率将SloWo操作记录到诊断日志中。
At higher 在更高的logLevel
settings, all operations appear in the diagnostic log regardless of their latency with the following exception: the logging of slow oplog entry messages by the secondaries. logLevel
设置下,所有操作都会显示在诊断日志中,而不管它们的延迟如何,但以下例外情况除外:辅助设备记录慢速oplog条目消息。The secondaries log only the slow oplog entries; increasing the 二级仅记录慢速oplog条目;增加logLevel
does not log all oplog entries.logLevel
不会记录所有oplog条目。
Changed in version 4.0.在版本4.0中更改。
slowOpThresholdMs
setting is available for mongod
and mongos
. slowOpThresholdMs
设置可用于mongod
和mongos
。slowOpThresholdMs
is available for mongod
only.slowOpThresholdMs
仅适用于mongod
。
mongod
instances, the setting affects both the diagnostic log and, if enabled, the profiler.mongod
实例,该设置会影响诊断日志和探查器(如果启用)。mongos
instances, the setting affects the diagnostic log only and not the profiler since profiling is not available on mongos
.mongos
实例,该设置仅影响诊断日志,而不影响探查器,因为在mongos
上无法进行评测。operationProfiling.slowOpSampleRate
Type类型: double
Default默认值: 1.0
The fraction of slow operations that should be profiled or logged. 应分析或记录的慢速操作的分数。operationProfiling.slowOpSampleRate
accepts values between 0 and 1, inclusive.接受介于0和1之间的值(包括0和1)。
Changed in version 4.0.在版本4.0中更改。
slowOpSampleRate
setting is available for mongod
and mongos
. slowOpSampleRate
设置适用于mongod
和mongos
。slowOpSampleRate
is available for mongod
only.slowOpSampleRate
仅适用于mongod
。
mongod
instances, the setting affects both the diagnostic log and, if enabled, the profiler.mongod
实例,该设置会影响诊断日志和探查器(如果启用)。mongos
instances, the setting affects the diagnostic log only and not the profiler since profiling is not available on mongos
.mongos
实例,该设置仅影响诊断日志,而不影响探查器,因为在mongos
上无法进行评测。operationProfiling.filter
Type类型: string representation of a query document查询文档的字符串表示形式
A filter expression that controls which operations are profiled and logged.一个筛选器表达式,用于控制分析和记录哪些操作。
When 设置filter
is set, slowOpThresholdMs
and slowOpSampleRate
are not used for profiling and slow-query log lines.filter
时,slowOpThresholdMs
和slowOpSampleRate
不用于分析和慢速查询日志行。
When you set a profile filter in the configuration file, the filter applies to all databases in the deployment. 在配置文件中设置配置文件筛选器时,该筛选器将应用于部署中的所有数据库。To set a profile filter for a specific database, use the 要为特定数据库设置配置文件筛选器,请使用db.setProfilingLevel()
method.db.setProfilingLevel()
方法。
The option takes a string representation of a query document of the form:该选项采用以下形式的查询文档的字符串表示:
{ <field1>: <expression1>, ... }
The <field>
can be any field in the profiler output. <field>
可以是探查器输出中的任何字段。The <expression>
is a query condition expression.<expression>
是查询条件表达式。
To specify a profiling filter in a configuration file, you must:要在配置文件中指定分析筛选器,必须:
For example, the following 例如,以下filter
configures the profiler to log query
operations that take longer than 2 seconds:filter
将探查器配置为记录耗时超过2秒的query
操作:
operationProfiling: mode: all filter: '{ op: "query", millis: { $gt: 2000 } }'
New in version 4.4.2.在版本4.4.2中新增。
replication
replication: oplogSizeMB: <int> replSetName: <string> enableMajorityReadConcern: <boolean>
replication.oplogSizeMB
Type类型: integer
The maximum size in megabytes for the replication operation log (i.e., the oplog).复制操作日志(即oplog)的最大大小(以MB为单位)。
Starting in MongoDB 4.0, the oplog can grow past its configured size limit to avoid deleting the 从MongoDB 4.0开始,oplog可以增长到超过其配置的大小限制,以避免删除多数提交点。majority commit point
.
By default, the 默认情况下,mongod
process creates an oplog based on the maximum amount of space available. mongod
进程根据可用的最大空间量创建oplog。For 64-bit systems, the oplog is typically 5% of available disk space.对于64位系统,oplog通常占可用磁盘空间的5%。
Once the 一旦mongod
has created the oplog for the first time, changing the replication.oplogSizeMB
option will not affect the size of the oplog. mongod
第一次创建了oplog,更改replication.oplogSizeMB
选项将不会影响oplog的大小。To change the maximum oplog size after starting the 要在启动mongod
, use replSetResizeOplog
. mongod
后更改最大oplog大小,请使用replSetResizeOplog
。replSetResizeOplog
enables you to resize the oplog dynamically without restarting the 允许您在不重新启动mongod
process. mongod
进程的情况下动态调整oplog的大小。To persist the changes made using 要通过重新启动来持久化使用replSetResizeOplog
through a restart, update the value of oplogSizeMB
.replSetResizeOplog
所做的更改,请更新oplogSizeMB
的值。
See Oplog Size for more information.有关更多信息,请参阅Oplog大小。
The replication.oplogSizeMB
setting is available only for mongod
.replication.oplogSizeMB
设置仅适用于mongod
。
replication.replSetName
Type类型: string
The name of the replica set that the mongod
is part of. All hosts in the replica set must have the same set name.mongod
所属的副本集的名称。副本集中的所有主机必须具有相同的集名称。
If your application connects to more than one replica set, each set must have a distinct name. Some drivers group replica set connections by replica set name.如果应用程序连接到多个副本集,则每个副本集必须具有不同的名称。一些驱动程序按副本集名称对副本集连接进行分组。
The replication.replSetName
setting is available only for mongod
.replication.replSetName
设置仅适用于mongod
。
Starting in MongoDB 4.0:从MongoDB 4.0开始:
replication.replSetName
cannot be used in conjunction with storage.indexBuildRetry
.replication.replSetName
不能与storage.indexBuildRetry
结合使用。storage.journal.enabled: false
cannot be used in conjunction with replication.replSetName
.storage.journal.enabled: false
不能与replication.replSetName
一起使用。replication.enableMajorityReadConcern
Default默认值: true
Configures support for 配置对"majority"
read concern."majority"
读关注点的支持。
Starting in MongoDB 5.0, 从MongoDB 5.0开始,enableMajorityReadConcern
cannot be changed and is always set to true
. enableMajorityReadConcern
不能更改,并且始终设置为true
。Attempting to start a storage engine that does not support majority read concern with the 尝试使用--enableMajorityReadConcern
option will fail and return an error message.--enableMajorityReadConcern
选项启动不支持多数读取问题的存储引擎将失败并返回错误消息。
In earlier versions of MongoDB, 在早期版本的MongoDB中,enableMajorityReadConcern
was configurable.enableMajorityReadConcern
是可配置的。
If you are using a three-member primary-secondary-arbiter (PSA) architecture, the write concern 如果您使用的是三成员主从仲裁器(PSA)体系结构,那么如果次要仲裁器不可用或滞后,写入关注点"majority"
can cause performance issues if a secondary is unavailable or lagging. "majority"
可能会导致性能问题。See Mitigate Performance Issues with PSA Replica Set for advice on how to mitigate these issues.有关如何缓解这些问题的建议,请参阅缓解PSA副本集的性能问题。
sharding
sharding: clusterRole: <string> archiveMovedChunks: <boolean>
sharding.clusterRole
Type类型: string
The role that the mongod
instance has in the sharded cluster. mongod
实例在分片集群中的角色。Set this setting to one of the following:将此设置设置为以下选项之一:
configsvr |
|
shardsvr |
|
Setting 设置sharding.clusterRole
requires the mongod
instance to be running with replication. sharding.clusterRole
要求mongod
实例与复制一起运行。To deploy the instance as a replica set member, use the 要将实例部署为副本集成员,请使用replSetName
setting and specify the name of the replica set.replSetName
设置并指定副本集的名称。
The sharding.clusterRole
setting is available only for mongod
.sharding.clusterRole
设置仅适用于mongod
。
auditLog
Available only in MongoDB Enterprise and MongoDB Atlas.仅在MongoDB Enterprise和MongoDB Atlas中可用。
auditLog: destination: <string> format: <string> path: <string> filter: <string>
auditLog.auditEncryptionKeyIdentifier
Type类型: string
New in version 5.3.在版本5.3中新增。
Specifies the unique identifier of the Key Management Interoperability Protocol (KMIP) key for audit log encryption.指定用于审核日志加密的密钥管理互操作性协议(KMIP)密钥的唯一标识符。
You cannot use 不能同时使用auditLog.auditEncryptionKeyIdentifier
and auditLog.localAuditKeyFile
together.auditLog.auditEncryptionKeyIdentifier
和auditLog.localAuditKeyFile
。
Available only in MongoDB Enterprise. 仅在MongoDB企业版中可用。MongoDB Enterprise and Atlas have different configuration requirements.MongoDB Enterprise和Atlas有不同的配置要求。
auditLog.compressionMode
Type类型: string
New in version 5.3.在版本5.3中新增。
Specifies the compression mode for audit log encryption. 指定审核日志加密的压缩模式。You must also enable audit log encryption using either 还必须使用auditLog.auditEncryptionKeyIdentifier
or auditLog.localAuditKeyFile
.auditLog.auditEncryptionKeyIdentifier
或auditLog.localAuditKeyFile
启用审核日志加密。
auditLog.compressionMode
can be set to one of these values:可以设置为以下值之一:
zstd | |
none (default) |
Available only in MongoDB Enterprise. 仅在MongoDB 企业版中可用。MongoDB Enterprise and Atlas have different configuration requirements.MongoDB Enterprise和Atlas有不同的配置要求。
auditLog.destination
Type类型: string
When set, 设置后,auditLog.destination
enables auditing and specifies where mongos
or mongod
sends all audit events.auditLog.destination
将启用审核,并指定mongos
或mongod
发送所有审核事件的位置。
auditLog.destination
can have one of the following values:可以具有以下值之一:
syslog |
|
console | stdout in JSON format.stdout 。 |
file | auditLog.path in the format specified in auditLog.format .auditLog.format 中指定的格式将审核事件输出到auditLog.path 中指定的文件。
|
Available only in MongoDB Enterprise and MongoDB Atlas.仅在MongoDB Enterprise和MongoDB Atlas中可用。
auditLog.filter
Type类型: string representation of a document:文档的字符串表示形式
The filter to limit the types of operations the audit system records. 用于限制审核系统记录的操作类型的筛选器。The option takes a string representation of a query document of the form:该选项采用以下形式的查询文档的字符串表示:
{ <field1>: <expression1>, ... }
The <field>
can be any field in the audit message, including fields returned in the param document. <field>
可以是审核消息中的任何字段,包括param
文档中返回的字段。The <expression>
is a query condition expression.<expression>
是一个查询条件表达式。
To specify an audit filter, enclose the filter document in single quotes to pass the document as a string.要指定审核筛选器,请将筛选器文档括在单引号中,以字符串形式传递文档。
To specify the audit filter in a configuration file, you must use the YAML format of the configuration file.要在配置文件中指定审核筛选器,必须使用配置文件的YAML格式。
Available only in MongoDB Enterprise and MongoDB Atlas.仅在MongoDB Enterprise和MongoDB Atlas中可用。
auditLog.format
Type类型: string
The format of the output file for auditing if 用于审核destination
is file
. destination
是否为file
的输出文件的格式。The auditLog.format
option can have one of the following values:auditLog.format
选项可以具有以下值之一:
JSON | auditLog.path .auditLog.path 中指定的文件。
|
BSON | auditLog.path .auditLog.path 中指定的文件。
|
Printing audit events to a file in JSON format degrades server performance more than printing to a file in BSON format.将审核事件打印到JSON格式的文件比打印到BSON格式的文件更会降低服务器性能。
Available only in MongoDB Enterprise and MongoDB Atlas.仅在MongoDB Enterprise和MongoDB Atlas中可用。
auditLog.localAuditKeyFile
Type类型: string
New in version 5.3.在版本5.3中新增。
Specifies the path and file name for a local audit key file for audit log encryption.指定用于审核日志加密的本地审核密钥文件的路径和文件名。
Only use 仅使用auditLog.localAuditKeyFile
for testing because the key is not secured. auditLog.localAuditKeyFile
进行测试,因为密钥不安全。To secure the key, use 要保护密钥,请使用auditLog.auditEncryptionKeyIdentifier
and an external Key Management Interoperability Protocol (KMIP) server.auditLog.auditEncryptionKeyIdentifier
和外部密钥管理互操作性协议(KMIP)服务器。
You cannot use 不能同时使用auditLog.localAuditKeyFile
and auditLog.auditEncryptionKeyIdentifier
together.auditLog.localAuditKeyFile
和auditLog.auditEncryptionKeyIdentifier
。
Available only in MongoDB Enterprise. 仅在MongoDB Enterprise中可用。MongoDB Enterprise and Atlas have different configuration requirements.MongoDB Enterprise和Atlas有不同的配置要求。
auditLog.path
Type类型: string
The output file for auditing if 用于审核destination
has value of file
. destination
是否具有file
值的输出文件。The auditLog.path
option can take either a full path name or a relative path name.auditLog.path
选项可以采用完整路径名或相对路径名。
auditLog.runtimeConfiguration
Type类型: boolean
Specifies if a node allows runtime configuration of audit filters and the auditAuthorizationSuccess variable. 指定节点是否允许运行时配置审核筛选器和auditAuthorizationSuccess
变量。If 如果为true
the node can take part in Online Audit Filter Management.true
,则节点可以参与在线审核筛选器管理。
Available only in MongoDB Enterprise and MongoDB Atlas.仅在MongoDB Enterprise和MongoDB Atlas中可用。
snmp
MongoDB Enterprise on macOS does not include support for SNMP due to SERVER-29352.由于SERVER-29352,macOS上的MongoDB Enterprise不支持SNMP。
snmp: disabled: <boolean> subagent: <boolean> master: <boolean>
snmp.disabled
Type类型: boolean
Default默认值: false
Disables SNMP access to 禁用对mongod
. mongod
的SNMP访问。The option is incompatible with 该选项与snmp.subagent
and snmp.master
.snmp.subagent
和snmp.master
不兼容。
Set to 设置为true
to disable SNMP access.true
可禁用SNMP访问。
The snmp.disabled
setting is available only for mongod
.snmp.disabled
设置仅适用于mongod
。
New in version 4.0.6.在版本4.0.6中新增。
snmp.subagent
Type类型: boolean
When 当snmp.subagent
is true
, SNMP runs as a subagent. snmp.subagent
为true
时,SNMP将作为子代理运行。The option is incompatible with 该选项与设置为snmp.disabled
set to true
.true
的snmp.disabled
不兼容。
The ssnmp.subagent
setting is available only for mongod
.snmp.subagent
设置仅适用于mongod
。
snmp.master
Type类型: boolean
When 当snmp.master
is true
, SNMP runs as a master. snmp.master
为true
时,SNMP将作为主机运行。The option is incompatible with 该选项与设置为snmp.disabled
set to true
.true
的snmp.disabled
不兼容。
The snmp.master
setting is available only for mongod
.snmp.master
设置仅适用于mongod
。
mongos
-only OptionsChanged in version 3.4.在版本3.4中更改。
sharding.chunkSize
and sharding.autoSplit
settings.sharding.chunkSize
和sharding.autoSplit
设置。
replication: localPingThresholdMs: <int> sharding: configDB: <string>
replication.localPingThresholdMs
Type类型: integer
Default默认值: 15
The ping time, in milliseconds, that mongos
uses to determine which secondary replica set members to pass read operations from clients. mongos
用于确定要从客户端传递读取操作的辅助副本集成员的ping时间(以毫秒为单位)。The default value of 默认值15
corresponds to the default value in all of the client drivers.15
对应于所有客户端驱动程序中的默认值。
When 当mongos
receives a request that permits reads to secondary members, the mongos
will:mongos
收到允许读取secondary成员的请求时,mongos
将:
Construct a list of replica set members that is within a ping time of 15 milliseconds of the nearest suitable member of the set.构建一个副本集成员的列表,该列表在距离该集最近的合适成员15毫秒的ping时间内。
If you specify a value for the 如果为replication.localPingThresholdMs
option, mongos
will construct the list of replica members that are within the latency allowed by this value.replication.localPingThresholdMs
选项指定一个值,mongos
将构建在该值允许的延迟范围内的副本成员列表。
The ping time used for a member compared by the 由replication.localPingThresholdMs
setting is a moving average of recent ping times, calculated at most every 10 seconds. replication.localPingThresholdMs
设置比较的成员使用的ping时间是最近ping时间的移动平均值,最多每10秒计算一次。As a result, some queries may reach members above the threshold until the 因此,在mongos
recalculates the average.mongos
重新计算平均值之前,一些查询可能会到达阈值以上的成员。
See the Read Preference for Replica Sets section of the read preference documentation for more information.有关更多信息,请参阅读取首选项文档中副本集的读取首选项部分。
sharding.configDB
Type类型: string
Changed in version 3.2.在版本3.2中更改。
The configuration servers for the sharded cluster.分片群集的配置服务器。
Starting in MongoDB 3.2, config servers for sharded clusters can be deployed as a replica set. 从MongoDB 3.2开始,可以将分片集群的配置服务器部署为副本集。The replica set config servers must run the WiredTiger storage engine. 副本集配置服务器必须运行WiredTiger存储引擎。MongoDB 3.2 deprecates the use of three mirrored MongoDB 3.2反对在配置服务器上使用三个镜像mongod
instances for config servers.mongod
实例。
Specify the config server replica set name and the hostname and port of at least one of the members of the config server replica set.指定配置服务器副本集名称以及至少一个配置服务器副本集成员的主机名和端口。
sharding: configDB: <configReplSetName>/cfg1.example.net:27019, cfg2.example.net:27019,...
The 分片集群的mongos
instances for the sharded cluster must specify the same config server replica set name but can specify hostname and port of different members of the replica set.mongos
实例必须指定相同的配置服务器副本集名称,但可以指定副本集不同成员的主机名和端口。
processManagement: windowsService: serviceName: <string> displayName: <string> description: <string> serviceUser: <string> servicePassword: <string>
processManagement.windowsService.serviceName
Type类型: string
Default默认值: MongoDB
The service name of 作为Windows服务运行时mongos
or mongod
when running as a Windows Service. mongos
或mongod
的服务名称。Use this name with the 将此名称用于net start <name>
and net stop <name>
operations.net start <name>
和net stop <name>
操作。
You must use 必须将processManagement.windowsService.serviceName
in conjunction with either the --install
or --remove
option.processManagement.windowsService.serviceName
与--install
或--remove
选项结合使用。
processManagement.windowsService.displayName
Type类型: string
Default默认值: MongoDB
The name listed for MongoDB on the Services administrative application.服务管理应用程序中为MongoDB列出的名称。
processManagement.windowsService.description
Type类型: string
Default默认值: MongoDB Server
Run 运行mongos
or mongod
service description.mongos
或mongod
服务描述。
You must use 必须将processManagement.windowsService.description
in conjunction with the --install
option.processManagement.windowsService.description
与--install
选项结合使用。
For descriptions that contain spaces, you must enclose the description in quotes.对于包含空格的描述,必须将描述括在引号中。
processManagement.windowsService.serviceUser
Type类型: string
The 特定用户上下文中的mongos
or mongod
service in the context of a certain user. mongos
或mongod
服务。This user must have "Log on as a service" privileges.此用户必须具有“作为服务登录”权限。
You must use 必须将processManagement.windowsService.serviceUser
in conjunction with the --install
option.processManagement.windowsService.serviceUser
与--install
选项结合使用。
processManagement.windowsService.servicePassword
Type类型: string
The password for 使用<user>
for mongos
or mongod
when running with the processManagement.windowsService.serviceUser
option.processManagement.windowsService.serviceUser
选项运行时,mongos
或mongod
的<user>
密码。
You must use 必须将processManagement.windowsService.servicePassword
in conjunction with the --install
option.processManagement.windowsService.servicePassword
与--install
选项结合使用。
Starting in version 4.2, MongoDB removes the deprecated MMAPv1 storage engine and the MMAPv1-specific configuration options:从4.2版开始,MongoDB删除了不推荐使用的MMAPv1存储引擎和特定于MMAPv1的配置选项:
storage.mmapv1.journal.commitIntervalMs | |
storage.mmapv1.journal.debugFlags | mongod --journalOptions |
storage.mmapv1.nsSize | mongod --nssize |
storage.mmapv1.preallocDataFiles | mongod --noprealloc |
storage.mmapv1.quota.enforced | mongod --quota |
storage.mmapv1.quota.maxFilesPerDB | mongod --quotaFiles |
storage.mmapv1.smallFiles | mongod --smallfiles |
storage.repairPath | mongod --repairpath |
replication.secondaryIndexPrefetch | mongod --replIndexPrefetch |
For earlier versions of MongoDB, refer to the corresponding version of the manual. For example:有关MongoDB的早期版本,请参阅相应版本的手册。例如: