mongod
Synopsis
mongod
is the primary daemon process for the MongoDBsystem. It handles data requests, manages data access, and performsbackground management operations.
This document provides a complete overview of all command line optionsfor mongod
. These command line options are primarily usefulfor testing: In common operation, use the configuration fileoptions to control the behavior ofyour database.
See also
Configuration File Settings and Command-Line Options Mapping
Note
Starting in version 4.0, MongoDB disables support for TLS 1.0encryption on systems where TLS 1.1+ is available. Formore details, see Disable TLS 1.0.
Options
Starting in version 4.2
- MongoDB deprecates the SSL options and insteads adds newcorresponding TLS options.
- MongoDB adds
—tlsClusterCAFile
/net.tls.clusterCAFile
. (Also availalbein 3.4.18+, 3.6.9+, 4.0.3+)
Core Options
—config
<filename>
,
-f
<filename>
- Specifies a configuration file for runtime configuration options. Theconfiguration file is the preferred method for runtime configuration ofmongod. The options are equivalent to the command-lineconfiguration options. See Configuration File Options formore information.
Ensure the configuration file uses ASCII encoding. The mongodinstance does not support configuration files with non-ASCII encoding,including UTF-8.
New in version 4.2.
Enables using Expansion Directivesin configuration files. Expansion directives allow you to setexternally sourced values for configuration file options.
—configExpand
supports the following expansion directives:
ValueDescriptionnone
Default. mongod does not expand expansion directives.mongod fails to start if any configuration file settingsuse expansion directives.rest
mongod expands rest
expansion directives whenparsing the configuration file.exec
mongod expands exec
expansion directives whenparsing the configuration file.
You can specify multiple expansion directives as a comma-separatedlist, e.g. rest, exec
. If the configuration file containsexpansion directives not specified to —configExpand
, the mongodreturns an error and terminates.
See Externally Sourced Configuration File Values for configuration filesfor more information on expansion directives.
—verbose
,
-v
- Increases the amount of internal reporting returned on standard outputor in log files. Increase the verbosity with the
-v
form byincluding the option multiple times, (e.g.-vvvvv
.)
Note
Starting in version 4.2, MongoDB includes the Debug verbosity level(1-5) in the log messages. For example,if the verbosity level is 2, MongoDB logs D2
. In previousversions, MongoDB log messages only specified D
for Debug level.
This option suppresses:
- output from database commands
- replication activity
- connection accepted events
- connection closed events
—port
<port>
Default:
- 27017 if
mongod
is not a shard member or a config server member - 27018 if
mongod
is ashard member
- 27019 if
mongod
is aconfig server member
The TCP port on which the MongoDB instance listens forclient connections.
- 27017 if
Note
Starting in MongoDB 3.6, mongod bind to localhostby default. See Default Bind to Localhost.
The hostnames and/or IP addresses and/or full Unix domain socketpaths on which mongod should listen for client connections. Youmay attach mongod to any interface. To bind to multipleaddresses, enter a list of comma-separated values.
Example
localhost,/tmp/mongod.sock
You can specify both IPv4 and IPv6 addresses, or hostnames thatresolve to an IPv4 or IPv6 address.
Example
localhost, 2001:0DB8:e132:ba26:0d5c:2774:e7f9:d513
Note
If specifying an IPv6 address or a hostname that resolves to anIPv6 address to —bind_ip
, you must start mongod with—ipv6
to enable IPv6 support. Specifying an IPv6 addressto —bind_ip
does not enable IPv6 support.
If specifying alink-local IPv6 address(fe80::/10
), you must append thezone indexto that address (i.e. fe80::<address>%<adapter-name>
).
Example
localhost,fe80::a00:27ff:fee0:1fcf%enp0s3
Tip
When possible, use a logical DNS hostname instead of an ip address,particularly when configuring replica set members or sharded clustermembers. The use of logical DNS hostnames avoids configurationchanges due to ip address changes.
Warning
Before binding to a non-localhost (e.g. publicly accessible)IP address, ensure you have secured your cluster from unauthorizedaccess. For a complete list of security recommendations, seeSecurity Checklist. At minimum, considerenabling authentication andhardening network infrastructure.
For more information about IP Binding, refer to theIP Binding documentation.
To bind to all IPv4 addresses, enter 0.0.0.0
.
To bind to all IPv4 and IPv6 addresses, enter ::,0.0.0.0
orstarting in MongoDB 4.2, an asterisk "*"
(enclose the asterisk inquotes to avoid filename pattern expansion). Alternatively, use thenet.bindIpAll
setting.
Note
—bind_ip
and—bind_ip_all
are mutually exclusive.Specifying both options causes mongod to throw an error andterminate.- The command-line option
—bind
overrides the configurationfile settingnet.bindIp
.
New in version 3.6.
If specified, the mongod instance binds to all IPv4addresses (i.e. 0.0.0.0
). If mongod starts with—ipv6
, —bind_ip_all
also binds to all IPv6 addresses(i.e. ::
).
mongod only supports IPv6 if started with —ipv6
. Specifying—bind_ip_all
alone does not enable IPv6 support.
Warning
Before binding to a non-localhost (e.g. publicly accessible)IP address, ensure you have secured your cluster from unauthorizedaccess. For a complete list of security recommendations, seeSecurity Checklist. At minimum, considerenabling authentication andhardening network infrastructure.
For more information about IP Binding, refer to theIP Binding documentation.
Alternatively, you can set the —bind_ip
option to ::,0.0.0.0
or, starting in MongoDB 4.2, to an asterisk "*"
(enclose theasterisk in quotes to avoid filename pattern expansion).
Note
—bind_ip
and —bind_ip_all
are mutually exclusive. Thatis, you can specify one or the other, but not both.
New in version 3.6.
A list of IP addresses/CIDR (Classless Inter-Domain Routing) ranges against which themongod
validates authentication requests from other members ofthe replica set and, if part of a sharded cluster, the mongos
instances. The mongod
verifies that the originating IP iseither explicitly in the list or belongs to a CIDR range in the list. If theIP address is not present, the server does not authenticate themongod
or mongos
.
—clusterIpSourceWhitelist
has no effect on a mongod
started withoutauthentication.
—clusterIpSourceWhitelist
accepts multiple comma-separated IPv4/6 addresses or ClasslessInter-Domain Routing (CIDR) ranges:
- mongod --clusterIpSourceWhitelist 192.0.2.0/24,127.0.0.1,::1
Important
Ensure —clusterIpSourceWhitelist
includes the IP address or CIDR ranges that include theIP address of each replica set member or mongos
in thedeployment to ensure healthy communication between cluster components.
Setting —ipv6
does not direct the mongod to listen on anylocal IPv6 addresses or interfaces. To configure the mongod tolisten on an IPv6 interface, you must either:
- Configure
—bind_ip
with one or more IPv6 addresses orhostnames that resolve to IPv6 addresses, or - Set
—bind_ip_all
totrue
.
New in version 3.6.
The maximum number of connections that can exist in the listenqueue.
Warning
Consult your local system’s documentation to understand thelimitations and configuration requirements before using thisparameter.
Important
To prevent undefined behavior, specify a value for thisparameter between 1
and the local system SOMAXCONN
constant.
The default value for the listenBacklog
parameter is set atcompile time to the target system SOMAXCONN
constant.SOMAXCONN
is the maximum valid value that is documented forthe backlog parameter to the listen system call.
Some systems may interpret SOMAXCONN
symbolically, and othersnumerically. The actual listen backlog applied in practice maydiffer from any numeric interpretation of the SOMAXCONN
constantor argument to —listenBacklog
, and may also be constrained bysystem settings like net.core.somaxconn
on Linux.
Passing a value for the listenBacklog
parameter that exceeds theSOMAXCONN
constant for the local system is, by the letter of thestandards, undefined behavior. Higher values may be silently integertruncated, may be ignored, may cause unexpected resourceconsumption, or have other adverse consequences.
On systems with workloads that exhibit connection spikes, for whichit is empirically known that the local system can honor highervalues for the backlog parameter than the SOMAXCONN
constant,setting the listenBacklog
parameter to a higher value may reduceoperation latency as observed by the client by reducing the numberof connections which are forced into a backoff state.
—maxConns
<number>
- The maximum number of simultaneous connections that mongod willaccept. This setting has no effect if it is higher than your operatingsystem’s configured maximum connection tracking threshold.
Do not assign too low of a value to this option, or you willencounter errors during normal application operation.
Note
Changed in version 2.6: MongoDB removed the upward limit on the maxIncomingConnections
setting.
—logpath
<path>
- Sends all diagnostic logging information to a log file instead of tostandard output or to the host’s syslog system. MongoDB createsthe log file at the path you specify.
By default, MongoDB will move any existing log file rather than overwriteit. To instead append to the log file, set the —logappend
option.
—syslog
- Sends all logging output to the host’s syslog system ratherthan to standard output or to a log file (
—logpath
).
The —syslog
option is not supported on Windows.
Warning
The syslog
daemon generates timestamps when it logs a message, notwhen MongoDB issues the message. This can lead to misleading timestampsfor log entries, especially when the system is under heavy load. Werecommend using the —logpath
option for production systems toensure accurate timestamps.
Starting in version 4.2, MongoDB includes the component in its log messages to syslog
.
- ... ACCESS [repl writer worker 5] Unsupported modification to roles collection ...
Specifies the facility level used when logging messages to syslog.The value you specify must be supported by youroperating system’s implementation of syslog. To use this option, youmust enable the —syslog
option.
—logappend
- Appends new entries to the end of the existing log file when the mongodinstance restarts. Without this option,
mongod
will back up theexisting log and create a new file.
New in version 3.0.0.
Determines the behavior for the logRotate
command.Specify either rename
or reopen
:
rename
renames the log file.reopen
closes and reopens the log file following the typicalLinux/Unix log rotate behavior. Usereopen
when using theLinux/Unix logrotate utility to avoid log loss.
If you specify reopen
, you must also use —logappend
.
The time format for timestamps in log messages. Specify one of thefollowing values:
ValueDescriptionctime
Displays timestamps as Wed Dec 3118:17:54.811
.iso8601-utc
Displays timestamps in Coordinated Universal Time (UTC) in theISO-8601 format. For example, for New York at the start of theEpoch: 1970-01-01T00:00:00.000Z
iso8601-local
Displays timestamps in local time in the ISO-8601format. For example, for New York at the start of the Epoch:1969-12-31T19:00:00.000-0500
—pidfilepath
<path>
- Specifies a file location to store the process ID (PID) of the mongodprocess . The user running the the
mongod
ormongos
process must be able to write to this path. If the—pidfilepath
option is notspecified, the process does not create a PID file. This option is generallyonly useful in combination with the the—fork
option.
Linux
On Linux, PID file management is generally the responsibility ofyour distro’s init system: usually a service file in the /etc/init.d
directory, or a systemd unit file registered with systemctl
. Onlyuse the —pidfilepath
option if you are not using one of these initsystems. For more information, please see the respectiveInstallation Guide for your operating system.
macOS
On macOS, PID file management is generally handled by brew
. Only usethe —pidfilepath
option if you are not using brew
on your macOS system.For more information, please see the respectiveInstallation Guide for your operating system.
—keyFile
<file>
- Specifies the path to a key file that stores the shared secretthat MongoDB instances use to authenticate to each other in asharded cluster or replica set.
—keyFile
implies—auth
. See Internal/Membership Authentication for moreinformation.
Starting in MongoDB 4.2, keyfiles for internal membershipauthentication use YAML format to allow formultiple keys in a keyfile. The YAML format accepts content of:
- a single key string (same as in earlier versions),
- multiple key strings (each string must be enclosed in quotes), or
- sequence of key strings.The YAML format is compatible with the existing single-keykeyfiles that use the text file format.
—setParameter
<options>
- Specifies one of the MongoDB parameters described inMongoDB Server Parameters. You can specify multiple
setParameter
fields.
—nounixsocket
- Disables listening on the UNIX domain socket.
—nounixsocket
applies onlyto Unix-based systems.
The mongod processalways listens on the UNIX socket unless one of the following is true:
—nounixsocket
is setnet.bindIp
is not setnet.bindIp
does not specifylocalhost
or its associated IP address
New in version 2.6: mongod installed from official .deb and .rpm packageshave the bind_ip
configuration set to 127.0.0.1
bydefault.
The path for the UNIX socket. —unixSocketPrefix
applies onlyto Unix-based systems.
If this option has no value, themongod process creates a socket with /tmp
as a prefix. MongoDBcreates and listens on a UNIX socket unless one of the following is true:
net.unixDomainSocket.enabled
isfalse
—nounixsocket
is setnet.bindIp
is not setnet.bindIp
does not specifylocalhost
or its associated IP address
Sets the permission for the UNIX domain socket file.
—filePermissions
applies only to Unix-based systems.
—fork
- Enables a daemon mode that runs the mongod process in thebackground. By default mongod does not run as a daemon:typically you will run mongod as a daemon, either by using
—fork
or by using a controlling process that handles thedaemonization process (e.g. as withupstart
andsystemd
).
The —fork
option is not supported on Windows.
—auth
- Enables authorization to control user’s access to database resourcesand operations. When authorization is enabled, MongoDB requires allclients to authenticate themselves first in order to determine theaccess for the client.
Configure users via the mongo shell. If no users exist, the localhost interfacewill continue to have access to the database until you createthe first user.
See Securityfor more information.
New in version 3.4: Allows the mongod to accept and create authenticated andnon-authenticated connections to and from other mongod
and mongos
instances in the deployment. Used forperforming rolling transition of replica sets or sharded clustersfrom a no-auth configuration to internal authentication. Requires specifying a internalauthentication mechanism such as—keyFile
.
For example, if using keyfiles forinternal authentication, the mongod createsan authenticated connection with any mongod
or mongos
in the deployment using a matching keyfile. If the security mechanisms donot match, the mongod utilizes a non-authenticated connection instead.
A mongod running with —transitionToAuth
does not enforce user accesscontrols. Users may connect to your deployment without anyaccess control checks and perform read, write, and administrative operations.
Note
A mongod running with internal authentication and without—transitionToAuth
requires clients to connectusing user access controls. Update clients toconnect to the mongod using the appropriate userprior to restarting mongod without —transitionToAuth
.
—cpu
- Forces the mongod process to report the percentage of CPU time inwrite lock, every four seconds.
—sysinfo
- Returns diagnostic system information and then exits. Theinformation provides the page size, the number of physical pages,and the number of available physical pages.
—notablescan
- Forbids operations that require a collection scan. See
notablescan
for additional information.
—shutdown
- The
—shutdown
option cleanly and safely terminates the mongodprocess. When invoking mongod with this option you must set the—dbpath
option either directly or by way of theconfiguration file and the—config
option.
The —shutdown
option is available only on Linux systems.
For additional ways to shut down, see also Stop mongod Processes.
New in version 3.4: Available in MongoDB Enterprise only.
A mongod running with —redactClientLogData
redacts any message accompanying a givenlog event before logging. This prevents the mongod from writingpotentially sensitive data stored on the database to the diagnostic log.Metadata such as error or operation codes, line numbers, and source filenames are still visible in the logs.
Use —redactClientLogData
in conjunction withEncryption at Rest andTLS/SSL (Transport Encryption) to assist compliance withregulatory requirements.
For example, a MongoDB deployment might store Personally IdentifiableInformation (PII) in one or more collections. The mongod logs eventssuch as those related to CRUD operations, sharding metadata, etc. It ispossible that the mongod may expose PII as a part of these loggingoperations. A mongod running with —redactClientLogData
removes any messageaccompanying these events before being output to the log, effectivelyremoving the PII.
Diagnostics on a mongod running with —redactClientLogData
may be more difficultdue to the lack of data related to a log event. See theprocess logging manual page for anexample of the effect of —redactClientLogData
on log output.
On a running mongod, use setParameter
with theredactClientLogData
parameter to configure this setting.
New in version 3.4.
Specifies the default compressor(s) to use forcommunication between this mongod instance and:
- other members of the deployment if the instance is part of a replica set or a sharded cluster
- a
mongo
shell drivers that support the
OP_COMPRESSED
message format.MongoDB supports the following compressors:- zlib (Available starting in MongoDB 3.6)
- zstd (Available starting in MongoDB 4.2)In versions 3.6 and 4.0,
mongod
andmongos
enable network compression by default withsnappy
as the compressor.
Starting in version 4.2, mongod
andmongos
instances default to both snappy,zstd,zlib
compressors, in that order.
To disable network compression, set the value to disabled
.
Important
Messages are compressed when both parties enable networkcompression. Otherwise, messages between the parties areuncompressed.
If you specify multiple compressors, then the order in which you listthe compressors matter as well as the communication initiator. Forexample, if a mongo
shell specifies the following networkcompressors zlib,snappy
and the mongod
specifiessnappy,zlib
, messages between mongo
shell andmongod
uses zlib
.
If the parties do not share at least one common compressor, messagesbetween the parties are uncompressed. For example, if amongo
shell specifies the network compressorzlib
and mongod
specifies snappy
, messagesbetween mongo
shell and mongod
are not compressed.
—timeZoneInfo
<path>
- The full path from which to load the time zone database. If this optionis not provided, then MongoDB will use its built-in time zone database.
The configuration file included with Linux and macOS packages sets the timezone database path to /usr/share/zoneinfo
by default.
The built-in time zone database is a copy of the Olson/IANA time zonedatabase. It is updated along with MongoDBreleases, but the release cycle of the time zone database differs from therelease cycle of MongoDB. A copy of the most recent release of the time zonedatabase can be downloaded fromhttps://downloads.mongodb.org/olson_tz_db/timezonedb-latest.zip.
- wget https://downloads.mongodb.org/olson_tz_db/timezonedb-latest.zip
- unzip timezonedb-latest.zip
- mongod --timeZoneInfo timezonedb-2017b/
See also
processManagement.timeZoneInfo
.
New in version 3.6.
Determines the threading and execution model mongod uses toexecute client requests. The —serviceExecutor
option accepts oneof the following values:
ValueDescriptionsynchronous
The mongod uses synchronous networking and manages itsnetworking thread pool on a per connection basis. Previousversions of MongoDB managed threads in this way.adaptive
The mongod uses the new experimental asynchronousnetworking mode with an adaptive thread pool which managesthreads on a per request basis. This mode should have moreconsistent performance and use less resources when there aremore inactive connections than database requests.
New in version 4.2.
Outputs the mongod instance’s configuration options, formattedin YAML, to stdout
and exits the mongod instance. Forconfiguration options that uses Externally Sourced Configuration File Values,—outputConfig
returns the resolved value for those options.
Warning
This may include any configured passwords or secrets previouslyobfuscated through the external source.
For usage examples, see:
- Output the Configuration File with Resolved Expansion Directive Values
- Convert Command-Line Options to YAML
Free Monitoring
New in version 4.0.
New in version 4.0: Available for MongoDB Community Edition.
Enables or disables free MongoDB Cloud monitoring. —enableFreeMonitoring
accepts the followingvalues:
runtime
Default. You can enable or disable free monitoring duringruntime.
To enable or disable free monitoring during runtime, seedb.enableFreeMonitoring()
anddb.disableFreeMonitoring()
.
To enable or disable free monitoring during runtime whenrunning with access control, users must have requiredprivileges. See db.enableFreeMonitoring()
anddb.disableFreeMonitoring()
for details.on
Enables free monitoring at startup; i.e. registers for freemonitoring. When enabled at startup, you cannot disable freemonitoring during runtime.off
Disables free monitoring at startup, regardless of whetheryou have previously registered for free monitoring. When disabled at startup,you cannot enable free monitoring during runtime.
Once enabled, the free monitoring state remains enabled untilexplicitly disabled. That is, you do not need to re-enable each timeyou start the server.
For the corresponding configuration file setting, seecloud.monitoring.free.state
.
New in version 4.0: Available for MongoDB Community Edition.
Optional tag to describe environment context. The tag can be sent aspart of the free MongoDB Cloud monitoring registration at start up.
For the corresponding configuration file setting, seecloud.monitoring.free.tags
.
LDAP Authentication or Authorization Options
New in version 3.4: Available in MongoDB Enterprise only.
The LDAP server against which the mongod authenticates users ordetermines what actions a user is authorized to perform on a givendatabase. If the LDAP server specified has any replicated instances,you may specify the host and port of each replicated server in acomma-delimited list.
If your LDAP infrastructure partitions the LDAP directory over multiple LDAPservers, specify one LDAP server or any of its replicated instances to—ldapServers
. MongoDB supports following LDAP referrals as defined in RFC 45114.1.10. Do not use —ldapServers
for listing every LDAP server in your infrastructure.
This setting can be configured on a running mongod usingsetParameter
.
If unset, mongod cannot use LDAP authentication or authorization.
New in version 3.4: Available in MongoDB Enterprise only.
The identity with which mongod binds as, when connecting to orperforming queries on an LDAP server.
Only required if any of the following are true:
- Using LDAP authorization.
- Using an LDAP query for
username transformation
. - The LDAP server disallows anonymous bindsYou must use
—ldapQueryUser
with—ldapQueryPassword
.
If unset, mongod will not attempt to bind to the LDAP server.
This setting can be configured on a running mongod usingsetParameter
.
Note
Windows MongoDB deployments can use —ldapBindWithOSDefaults
instead of —ldapQueryUser
and —ldapQueryPassword
. You cannot specifyboth —ldapQueryUser
and —ldapBindWithOSDefaults
at the same time.
New in version 3.4: Available in MongoDB Enterprise only.
The password used to bind to an LDAP server when using—ldapQueryUser
. You must use —ldapQueryPassword
with—ldapQueryUser
.
If unset, mongod will not attempt to bind to the LDAP server.
This setting can be configured on a running mongod usingsetParameter
.
Note
Windows MongoDB deployments can use —ldapBindWithOSDefaults
instead of —ldapQueryPassword
and —ldapQueryPassword
. You cannot specifyboth —ldapQueryPassword
and —ldapBindWithOSDefaults
at the same time.
New in version 3.4: Available in MongoDB Enterprise for the Windows platform only.
Allows mongod to authenticate, or bind, using your Windows logincredentials when connecting to the LDAP server.
Only required if:
- Using LDAP authorization.
- Using an LDAP query for
username transformation
. - The LDAP server disallows anonymous bindsUse
—ldapBindWithOSDefaults
to replace—ldapQueryUser
and—ldapQueryPassword
.
New in version 3.4: Available in MongoDB Enterprise only.
The method mongod uses to authenticate to an LDAP server.Use with —ldapQueryUser
and —ldapQueryPassword
toconnect to the LDAP server.
—ldapBindMethod
supports the following values:
simple
- mongod uses simple authentication.sasl
- mongod uses SASL protocol for authenticationIf you specifysasl
, you can configure the available SASL mechanismsusing—ldapBindSASLMechanisms
. mongod defaults tousingDIGEST-MD5
mechanism.
New in version 3.4: Available in MongoDB Enterprise only.
A comma-separated list of SASL mechanisms mongod canuse when authenticating to the LDAP server. The mongod and theLDAP server must agree on at least one mechanism. The mongoddynamically loads any SASL mechanism libraries installed on the hostmachine at runtime.
Install and configure the appropriate libraries for the selectedSASL mechanism(s) on both the mongod host and the remoteLDAP server host. Your operating system may include certain SASLlibraries by default. Defer to the documentation associated with eachSASL mechanism for guidance on installation and configuration.
If using the GSSAPI
SASL mechanism for use withKerberos Authentication, verify the following for themongod host machine:
Linux
- The
KRB5_CLIENT_KTNAME
environmentvariable resolves to the name of the client Linux Keytab Filesfor the host machine. For more on Kerberos environmentvariables, please defer to theKerberos documentation. - The client keytab includes aUser Principal for the mongod to use whenconnecting to the LDAP server and execute LDAP queries.
- The
Windows
- If connecting to an Active Directory server, the WindowsKerberos configuration automatically generates aTicket-Granting-Ticket.aspx)when the user logs onto the system. Set
—ldapBindWithOSDefaults
totrue
to allow mongod to use the generated credentials whenconnecting to the Active Directory server and execute queries.Set—ldapBindMethod
tosasl
to use this option.
Note
For a complete list of SASL mechanisms see theIANA listing.Defer to the documentation for your LDAP or Active Directoryservice for identifying the SASL mechanisms compatible with theservice.
MongoDB is not a source of SASL mechanism libraries, noris the MongoDB documentation a definitive source forinstalling or configuring any given SASL mechanism. Fordocumentation and support, defer to the SASL mechanismlibrary vendor or owner.
For more information on SASL, defer to the following resources:
- For Linux, please see the Cyrus SASL documentation.
- For Windows, please see the Windows SASL documentation.
New in version 3.4: Available in MongoDB Enterprise only.
By default, mongod creates a TLS/SSL secured connection to the LDAPserver.
For Linux deployments, you must configure the appropriate TLS Options in/etc/openldap/ldap.conf
file. Your operating system’s package managercreates this file as part of the MongoDB Enterprise installation, via thelibldap
dependency. See the documentation for TLS Options
in theldap.conf OpenLDAP documentationfor more complete instructions.
For Windows deployment, you must add the LDAP server CA certificates to theWindows certificate management tool. The exact name and functionality of thetool may vary depending on operating system version. Please see thedocumentation for your version of Windows for more information oncertificate management.
Set —ldapTransportSecurity
to none
to disable TLS/SSL between mongod and the LDAPserver.
Warning
Setting —ldapTransportSecurity
to none
transmits plaintext information and possiblycredentials between mongod and the LDAP server.
New in version 3.4: Available in MongoDB Enterprise only.
The amount of time in milliseconds mongod should wait for an LDAP serverto respond to a request.
Increasing the value of —ldapTimeoutMS
may prevent connection failure between theMongoDB server and the LDAP server, if the source of the failure is aconnection timeout. Decreasing the value of —ldapTimeoutMS
reduces the timeMongoDB waits for a response from the LDAP server.
This setting can be configured on a running mongod usingsetParameter
.
New in version 3.4: Available in MongoDB Enterprise only.
Maps the username provided to mongod for authentication to a LDAPDistinguished Name (DN). You may need to use —ldapUserToDNMapping
to transform ausername into an LDAP DN in the following scenarios:
- Performing LDAP authentication with simple LDAP binding, where usersauthenticate to MongoDB with usernames that are not full LDAP DNs.
- Using an
LDAP authorization query template
that requires a DN. - Transforming the usernames of clients authenticating to Mongo DB usingdifferent authentication mechanisms (e.g. x.509, kerberos) to a full LDAPDN for authorization.
—ldapUserToDNMapping
expects a quote-enclosed JSON-string representing an ordered arrayof documents. Each document contains a regular expressionmatch
andeither asubstitution
orldapQuery
template used for transforming theincoming username.
Each document in the array has the following form:
- {
- match: "<regex>"
- substitution: "<LDAP DN>" | ldapQuery: "<LDAP Query>"
- }
FieldDescriptionExamplematch
An ECMAScript-formatted regular expression (regex) to match against aprovided username. Each parenthesis-enclosed section represents aregex capture group used by substitution
or ldapQuery
."(.+)ENGINEERING"
"(.+)DBA"
substitution
An LDAP distinguished name (DN) formatting template that converts theauthentication name matched by the match
regex into a LDAP DN.Each curly bracket-enclosed numeric value is replaced by thecorresponding regex capture group extractedfrom the authentication username via the match
regex.
The result of the substitution must be an RFC4514 escaped string."cn={0},ou=engineering,dc=example,dc=com"
ldapQuery
A LDAP query formatting template that inserts the authenticationname matched by the match
regex into an LDAP query URI encodedrespecting RFC4515 and RFC4516. Each curly bracket-enclosed numericvalue is replaced by the corresponding regex capture group extractedfrom the authentication username via the match
expression.mongod executes the query against the LDAP server to retrievethe LDAP DN for the authenticated user. mongod requiresexactly one returned result for the transformation to besuccessful, or mongod skips this transformation."ou=engineering,dc=example,dc=com??one?(user={0})"
Note
An explanation of RFC4514,RFC4515,RFC4516, or LDAP queries is outof scope for the MongoDB Documentation. Please review the RFC directly oruse your preferred LDAP resource.
For each document in the array, you must use either substitution
orldapQuery
. You cannot specify both in the same document.
When performing authentication or authorization, mongod steps througheach document in the array in the given order, checking the authenticationusername against the match
filter. If a match is found,mongod applies the transformation and uses the output forauthenticating the user. mongod does not check the remaining documentsin the array.
If the given document does not match the provided authentication name, orthe transformation described by the document fails, mongod continuesthrough the list of documents to find additional matches. If no matches arefound in any document, mongod returns an error.
Example
The following shows two transformation documents. The firstdocument matches against any string ending in @ENGINEERING
, placinganything preceeding the suffix into a regex capture group. Thesecond document matches against any string ending in @DBA
, placinganything preceeding the suffix into a regex capture group.
Important
You must pass the array to —ldapUserToDNMapping
as a string.
- "[
- {
- 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 firstdocument. The regex capture group {0}
corresponds to the stringalice
. The resulting output is the DN"cn=alice,ou=engineering,dc=example,dc=com"
.
A user with username bob@DBA.EXAMPLE.COM
matches the second document.The regex capture group {0}
corresponds to the string bob
. Theresulting output is the LDAP query"ou=dba,dc=example,dc=com??one?(user=bob)"
. mongod executes thisquery against the LDAP server, returning the result"cn=bob,ou=dba,dc=example,dc=com"
.
If —ldapUserToDNMapping
is unset, mongod applies no transformations to the usernamewhen attempting to authenticate or authorize a user against the LDAP server.
This setting can be configured on a running mongod using thesetParameter
database command.
New in version 3.4: Available in MongoDB Enterprise only.
A relative LDAP query URL formatted conforming to RFC4515 and RFC4516 that mongod executes to obtainthe LDAP groups to which the authenticated user belongs to. The query isrelative to the host or hosts specified in —ldapServers
.
In the URL, you can use the following substituion tokens:
Substitution TokenDescription{USER}
Substitutes the authenticated username, or thetransformed
username if a username mapping
is specified.{PROVIDED_USER}
Substitutes the supplied username, i.e. before eitherauthentication or LDAP transformation
.
New in version 4.2.
When constructing the query URL, ensure that the order of LDAP parametersrespects RFC4516:
- [ dn [ ? [attributes] [ ? [scope] [ ? [filter] [ ? [Extensions] ] ] ] ] ]
If your query includes an attribute, mongod assumes that the queryretrieves a the DNs which this entity is member of.
If your query does not include an attribute, mongod assumesthe query retrieves all entities which the user is member of.
For each LDAP DN returned by the query, mongod assigns the authorizeduser a corresponding role on the admin
database. If a role on the on theadmin
database exactly matches the DN, mongod grants the user theroles and privileges assigned to that role. See thedb.createRole()
method for more information on creating roles.
Example
This LDAP query returns any groups listed in the LDAP user object’smemberOf
attribute.
- "{USER}?memberOf?base"
Your LDAP configuration may not include the memberOf
attribute as partof the user schema, may possess a different attribute for reporting groupmembership, or may not track group membership through attributes.Configure your query with respect to your own unique LDAP configuration.
If unset, mongod cannot authorize users using LDAP.
This setting can be configured on a running mongod using thesetParameter
database command.
Note
An explanation of RFC4515,RFC4516 or LDAP queries is outof scope for the MongoDB Documentation. Please review the RFC directly oruse your preferred LDAP resource.
Storage Options
Note
Starting in version 4.2, MongoDB removes the deprecated MMAPv1 storageengine.
Specifies the storage engine for the mongod database. Availablevalues include:
ValueDescriptionwiredTiger
To specify the WiredTiger Storage Engine.inMemory
To specify the In-Memory Storage Engine.
New in version 3.2: Available in MongoDB Enterprise only.
If you attempt to start a mongod with a—dbpath
that contains data files produced by astorage engine other than the one specified by —storageEngine
, mongodwill refuse to start.
The directory where the mongod instance stores its data.
If youinstalled MongoDB using a package management system, check the/etc/mongod.conf
file provided by your packages to see thedirectory is specified.
Changed in version 3.0: The files in —dbpath
must correspond to the storage enginespecified in —storageEngine
. If the data files do notcorrespond to —storageEngine
, mongod will refuse tostart.
—directoryperdb
- Uses a separate directory to store data for each database. Thedirectories are under the
—dbpath
directory, and each subdirectoryname corresponds to the database name.
Changed in version 3.0: To change the —directoryperdb
option for existing deployments, you mustrestart the mongod
instances with the new —directoryperdb
value and a new data directory (—dbpath <new path>
), and thenrepopulate the data.
- For standalone instances, you can use
mongodump
onthe existing instance, stop the instance, restart with the new—directoryperdb
value and a new data directory, and usemongorestore
to populate the new data directory. - For replica sets, you can update in a rolling manner by stoppinga secondary member, restart with the new
—directoryperdb
value anda new data directory, and use initial sync to populate the new data directory.To update all members, start with the secondary members first.Then step down the primary, and update the stepped-down member.
Not available for mongod
instances that use thein-memory storage engine.
Changed in version 4.0: —noIndexBuildRetry
cannot be used inconjunction with —replSet
; i.e., you cannotuse —noIndexBuildRetry
for a mongod
instance that is part ofa replica set.
Stops the mongod**standalone instance from rebuilding incomplete indexes on the nextstart up. This applies in cases where the mongod restarts after ithas shut down or stopped in the middle of an index build. In such cases,the mongod always removes any incomplete indexes, and then also, bydefault, attempts to rebuild them. To stop the mongod** fromrebuilding incomplete indexes on start up, include this option on thecommand-line.
The —noIndexBuildRetry
only applies to standalones.
Not available for mongod
instances that use thein-memory storage engine.
Controls how much time can pass before MongoDB flushes data to the datafiles via an fsync operation.
Do not set this value onproduction systems. In almost every situation, you should use thedefault setting.
Warning
If you set —syncdelay
to 0
, MongoDB will not sync thememory mapped files to disk.
The mongod process writes data very quickly to the journal andlazily to the data files. —syncdelay
has no effect on thejournal
files or journaling,but if —syncdelay
is set to 0
the journal will eventually consumeall available disk space. If you set —syncdelay
to 0
for testingpurposes, you should also set —nojournal
to true
.
The serverStatus
command reports the background flushthread’s status via the backgroundFlushing
field.
Not available for mongod
instances that use thein-memory storage engine.
—upgrade
- Upgrades the on-disk data format of the files specified by the
—dbpath
to the latest version, if needed.
This option only affects the operation of the mongod if the datafiles are in an old format.
In most cases you should not set this value, so you can exercise themost control over your upgrade process. See the MongoDB release notesfor more information about the upgrade process.
Changed in version 4.0.3.
Runs a repair routine on all databases for a mongod
instance. The operation attempts to salvage corrupt data as well asrebuilds all the indexes. The operation discards any corrupt datathat cannot be salvaged.
Tip
If you are running with journaling enabled, there isalmost never any need to run repair since the server can use thejournal files to restore the data files to a clean state automatically.However, you may need to run repair in cases where you need to recoverfrom a disk-level data corruption.
Warning
- Only use
mongod —repair
if you have no other options.The operation removes and does not save any corrupt data duringthe repair process. - Avoid running
—repair
againsta replica set member:- To repair a replica set member, if you have an intactcopy of your data available (e.g. a recent backup or an intactmember of the replica set), restore from that intactcopy instead(see Resync a Member of a Replica Set).
- If you do choose to run
mongod —repair
against areplica set member and the operation modifies the data or themetadata, you must still perform a full resync in order for themember to rejoin the replica set.
- Before using
—repair
, make a backupcopy of thedbpath
directory. - If repair fails to complete for any reason, you must restart theinstance using the
—repair
option.
—journal
- Enables the durability journal to ensure data files remain validand recoverable. This option applies only when you specify the
—dbpath
option. mongod enables journaling by default.
Not available for mongod
instances that use thein-memory storage engine.
If any voting member of a replica set uses the in-memorystorage engine, you must setwriteConcernMajorityJournalDefault
to false
.
Starting in version 4.2 (and 4.0.13 and 3.6.14 ), if a replica setmember uses the in-memory storage engine(voting or non-voting) but the replica set haswriteConcernMajorityJournalDefault
set to true, thereplica set member logs a startup warning.
—nojournal
- Disables journaling. mongodenables journaling by default.
Not available for mongod
instances that use thein-memory storage engine.
Starting in MongoDB 4.0, you cannot specify —nojournal
option or storage.journal.enabled:false
for replica set members that use theWiredTiger storage engine.
The maximum amount of time in milliseconds thatthe mongod process allows betweenjournal operations. Values can range from 1 to 500 milliseconds. Lowervalues increase the durability of the journal, at the expense of diskperformance.
On WiredTiger, the default journal commit interval is 100milliseconds. Additionally, a write that includes or impliesj:true
will cause an immediate sync of the journal. For detailsor additional conditions that affect the frequency of the sync, seeJournaling Process.
Not available for mongod
instances that use thein-memory storage engine.
Note
Known Issue in 4.2.0: The —journalCommitInterval
is missing in 4.2.0.
WiredTiger Options
—wiredTigerCacheSizeGB
<float>
- Defines the maximum size of the internal cache that WiredTiger willuse for all data. The memory consumed by an index build (see
maxIndexBuildMemoryUsageMegabytes
) is separate from theWiredTiger cache memory. Starting in MongoDB 3.4, the values can rangefrom 0.25 GB to 10000 GB and can be a float.
Starting in MongoDB 3.4, the default WiredTiger internal cache size isthe larger of either:
- 50% of (RAM - 1 GB), or
- 256 MB.For example, on a system with a total of 4GB of RAM the WiredTigercache will use 1.5GB of RAM (
0.5 (4 GB - 1 GB) = 1.5 GB
).Conversely, a system with a total of 1.25 GB of RAM will allocate 256MB to the WiredTiger cache because that is more than half of thetotal RAM minus one gigabyte (0.5
(1.25 GB - 1 GB) = 128 MB < 256 MB
).
Note
In some instances, such as when running in a container, the databasecan have memory constraints that are lower than the total systemmemory. In such instances, this memory limit, rather than the totalsystem memory, is used as the maximum RAM available.
To see the memory limit, see hostInfo.system.memLimitMB
.
Avoid increasing the WiredTiger internal cache size above itsdefault value.
With WiredTiger, MongoDB utilizes both the WiredTiger internal cacheand the filesystem cache.
Via the filesystem cache, MongoDB automatically uses all free memorythat is not used by the WiredTiger cache or by other processes.
Note
The —wiredTigerCacheSizeGB
limits the size of the WiredTiger internalcache. The operating system will use the available free memoryfor filesystem cache, which allows the compressed MongoDB datafiles to stay in memory. In addition, the operating system willuse any free RAM to buffer file system blocks and file systemcache.
To accommodate the additional consumers of RAM, you may have todecrease WiredTiger internal cache size.
The default WiredTiger internal cache size value assumes that there is asingle mongod
instance per machine. If a single machinecontains multiple MongoDB instances, then you should decrease the setting toaccommodate the other mongod
instances.
If you run mongod
in a container (e.g. lxc
,cgroups
, Docker, etc.) that does not have access to all of theRAM available in a system, you must set —wiredTigerCacheSizeGB
to a valueless than the amount of RAM available in the container. The exactamount depends on the other processes running in the container. SeememLimitMB
.
—wiredTigerMaxCacheOverflowFileSizeGB
<float>
- Specifies the maximum size (in GB) for the “lookaside (or cacheoverflow) table” file
WiredTigerLAS.wt
.
The setting can accept the following values:
ValueDescription0
The default value. If set to 0
, the file size isunbounded.number >= 0.1The maximum size (in GB). If the WiredTigerLAS.wt
file exceeds this size, mongod
exits with afatal assertion. You can clear the WiredTigerLAS.wt
file and restart mongod
.
To change the maximum size during runtime, use thewiredTigerMaxCacheOverflowSizeGB
parameter.
Available starting in MongoDB 4.2.1 (and 4.0.12)
New in version 3.0.0.
Specifies the type of compression to use to compress WiredTigerjournal data.
Available compressors are:
New in version 3.0.0.
When you start mongod with —wiredTigerDirectoryForIndexes
, mongod stores indexes and collections in separatesubdirectories under the data (i.e. —dbpath
) directory.Specifically, mongod stores the indexes in a subdirectory namedindex
and the collection data in a subdirectory namedcollection
.
By using a symbolic link, you can specify a different location forthe indexes. Specifically, when mongod
instance is notrunning, move the index
subdirectory to the destination andcreate a symbolic link named index
under the data directory tothe new destination.
New in version 3.0.0.
Specifies the default compression for collection data. You canoverride this on a per-collection basis when creating collections.
Available compressors are:
none
- snappy
- zlib
- zstd (Available starting MongoDB 4.2)
—wiredTigerCollectionBlockCompressor
affects all collections created. If you changethe value of—wiredTigerCollectionBlockCompressor
on an existing MongoDB deployment, all newcollections will use the specified compressor. Existing collectionswill continue to use the compressor specified when they werecreated, or the default compressor at that time.
New in version 3.0.0.
Enables or disables prefix compression for index data.
Specify true
for —wiredTigerIndexPrefixCompression
to enable prefix compression forindex data, or false
to disable prefix compression for index data.
The —wiredTigerIndexPrefixCompression
setting affects all indexes created. If you changethe value of —wiredTigerIndexPrefixCompression
on an existing MongoDB deployment, all newindexes will use prefix compression. Existing indexesare not affected.
Replication Options
—replSet
<setname>
- Configures replication. Specify a replica set name as an argument tothis set. All hosts in the replica set must have the same set name.
Starting in MongoDB 4.0,
—replSet
cannot be used in conjunction with—noIndexBuildRetry
.- For the WiredTiger storage engine,
—replSet
cannot be used inconjunction with—nojournal
.If your application connects to more than one replica set, each setshould have a distinct name. Some drivers group replica setconnections by replica set name.
—oplogSize
<value>
- Specifies a maximum size in megabytes for the replication operation log(i.e., the oplog).
Note
Starting in MongoDB 4.0, the oplog can grow past its configured sizelimit to avoid deleting the majority commit point
.
By default, the mongod process creates an oplog based onthe maximum amount of space available. For 64-bit systems, the oplogis typically 5% of available disk space.
Once the mongod has created the oplog for the first time,changing the —oplogSize
option will not affect the size of the oplog.
To change the oplog size of a running replica set member, use thereplSetResizeOplog
administrative command.replSetResizeOplog
enables you to resize the oplogdynamically without restarting the mongod
process.
See Oplog Size for more information.
Starting in MongoDB 3.6, MongoDB enables support for"majority"
read concern by default.
You can disable read concern "majority"
to preventthe storage cache pressure from immobilizing a deployment with athree-member primary-secondary-arbiter (PSA) architecture. For moreinformation about disabling read concern "majority"
,see Disable Read Concern Majority.
To disable, set —enableMajorityReadConcern
to false. —enableMajorityReadConcern
has no effect forMongoDB versions: 4.0.0, 4.0.1, 4.0.2, 3.6.0.
Important
In general, avoid disabling "majority"
read concernunless necessary. However, if you have a three-member replica setwith a primary-secondary-arbiter (PSA) architecture or a shardedcluster with a three-member PSA shards, disable to prevent thestorage cache pressure from immobilizing the deployment.
Disabling "majority"
read concern affects support fortransactions on sharded clusters. Specifically:
- A transaction cannot use read concern
"snapshot"
ifthe transaction involves a shard that has disabled readconcern “majority”. - A transaction that writes to multiple shards errors if any of thetransaction’s read or write operations involves a shard that hasdisabled read concern
"majority"
.However, it does not affect transactionson replica sets. For transactions on replica sets, you can specifyread concern"majority"
(or"snapshot"
or"local"
) for multi-document transactions even ifread concern"majority"
is disabled.
Disabling "majority"
read concern disables supportfor Change Streams for MongoDB 4.0 and earlier. For MongoDB4.2+, disabling read concern "majority"
has no effect on changestreams availability.
Sharded Cluster Options
Declares that this mongod instance serves as the configserver of a sharded cluster. Whenrunning with this option, clients (i.e. other cluster components)cannot write data to any database other than config
and admin
. The default port for a mongod with this option is27019
and the default —dbpath
directory is/data/configdb
, unless specified.
Important
Starting in 3.4, you must deploy config servers as a replica set.The use of the deprecated mirrored mongod
instances asconfig servers (SCCC) is no longer supported.
The replica set config servers (CSRS) must run theWiredTiger storage engine.
The —configsvr
option creates a local oplog.
Do not use the —configsvr
option with —shardsvr
. Configservers cannot be a shard server.
Do not use the —configsvr
with theskipShardingConfigurationChecks
parameter. That is, ifyou are temporarily starting the mongod
as astandalone for maintenance operations, include the parameterskipShardingConfigurationChecks
and exclude —configsvr
.Once maintenance has completed, remove theskipShardingConfigurationChecks
parameter and restartwith —configsvr
.
If set to sccc
, indicates that the config servers are deployedas three mirrored mongod
instances, even if one or moreconfig servers is also a member of a replica set. configsvrMode
only accepts the value sccc
.
If unset, config servers running as replica sets expect to use the“config server replica set” protocol for writing to config servers,rather than the “mirrored mongod” write protocol.
Configures this mongod instance as a shard in asharded cluster. The default port for these instances is27018
.
Important
Starting in MongoDB 3.6, you must deploy shards as replica sets. See the —replSet
option to deploy mongod as part of a replica set.
Do not use the —shardsvr
with theskipShardingConfigurationChecks
parameter. That is, ifyou are temporarily starting the mongod
as astandalone for maintenance operations, include the parameterskipShardingConfigurationChecks
and exclude —shardsvr
.Once maintenance has completed, remove theskipShardingConfigurationChecks
parameter and restartwith —shardsvr
.
—moveParanoia
- If specified, during chunk migration, a shard saves,to the
moveChunk
directory of the—dbpath
, all documentsmigrated from that shard.
MongoDB does not automatically delete the data saved in themoveChunk
directory.
Changed in version 3.2: Starting in 3.2, MongoDB uses —noMoveParanoia
as the default.
During chunk migration, a shard does not save documents migrated fromthe shard.
TLS Options
See
Configure mongod and mongos for TLS/SSL for fulldocumentation of MongoDB’s support.
New in version 4.2.
Enables TLS used for all network connections. Theargument to the —tlsMode
option can be one of the following:
ValueDescriptiondisabled
The server does not use TLS.allowTLS
Connections between servers do not use TLS. For incomingconnections, the server accepts both TLS and non-TLS.preferTLS
Connections between servers use TLS. For incomingconnections, the server accepts both TLS and non-TLS.requireTLS
The server uses and accepts only TLS encrypted connections.
If —tlsCAFile
or tls.CAFile
is notspecified and you are not using x.509 authentication, thesystem-wide CA certificate store will be used when connecting to anTLS-enabled server.
If using x.509 authentication, —tlsCAFile
or tls.CAFile
must be specified unless using —tlsCertificateSelector
.
For more information about TLS and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
New in version 4.2.
Note
Starting in 4.0, on macOS or Windows, you can use a certificate fromthe operating system’s secure store instead of specifying a PEM file. See—tlsCertificateSelector
.
Specifies the .pem
file that contains both the TLS certificateand key.
- On Linux/BSD, you must specify
—tlsCertificateKeyFile
when TLS is enabled. - On Windows or macOS, you must specify either
—tlsCertificateKeyFile
or—tlsCertificateSelector
when TLS is enabled.For more information about TLS and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
New in version 4.2.
Specifies the password to de-crypt the certificate-key file (i.e.—tlsCertificateKeyFile
). Use the —tlsCertificateKeyFilePassword
option only if thecertificate-key file is encrypted. In all cases, the mongod willredact the password from all logging and reporting output.
Starting in MongoDB 4.0:
- On Linux/BSD, if the private key in the PEM file is encrypted andyou do not specify the
—tlsCertificateKeyFilePassword
option, MongoDB will prompt for apassphrase. See TLS/SSL Certificate Passphrase. - On macOS or Windows, if the private key in the PEM file isencrypted, you must explicitly specify the
—tlsCertificateKeyFilePassword
option.Alternatively, you can use a certificate from the secure systemstore (see—tlsCertificateSelector
) instead of a PEM file or use anunencrypted PEM file.For more information about TLS and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
New in version 2.6.
The authentication mode used for cluster authentication. If you useinternal x.509 authentication,specify so here. This option can have one of the following values:
ValueDescriptionkeyFile
Use a keyfile for authentication.Accept only keyfiles.sendKeyFile
For rolling upgrade purposes. Send a keyfile forauthentication but can accept both keyfiles and x.509certificates.sendX509
For rolling upgrade purposes. Send the x.509 certificate forauthentication but can accept both keyfiles and x.509certificates.x509
Recommended. Send the x.509 certificate for authentication andaccept only x.509 certificates.
If —tlsCAFile
or tls.CAFile
is notspecified and you are not using x.509 authentication, thesystem-wide CA certificate store will be used when connecting to anTLS-enabled server.
If using x.509 authentication, —tlsCAFile
or tls.CAFile
must be specified unless using —tlsCertificateSelector
.
For more information about TLS and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
New in version 4.2.
Note
Starting in 4.0, on macOS or Windows, you can use a certificatefrom the operating system’s secure store instead of a PEMfile. See —tlsClusterCertificateSelector
.
Specifies the .pem
file that contains the x.509 certificate-keyfile for membership authenticationfor the cluster or replica set.
If —tlsClusterFile
does not specify the .pem
file for internal clusterauthentication or the alternative—tlsClusterCertificateSelector
, the cluster uses the.pem
file specified in the —tlsCertificateKeyFile
option orthe certificate returned by the —tlsCertificateSelector
.
If using x.509 authentication, —tlsCAFile
or tls.CAFile
must be specified unless using —tlsCertificateSelector
.
For more information about TLS and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
New in version 4.2: Available on Windows and macOS as an alternative to —tlsCertificateKeyFile
.
The —tlsCertificateKeyFile
and —tlsCertificateSelector
options are mutually exclusive. You can onlyspecify one.
Specifies a certificate property in order to select a matchingcertificate from the operating system’s certificate store.
—tlsCertificateSelector
accepts an argument of the format <property>=<value>
where the property can be one of the following:
PropertyValue typeDescriptionsubject
ASCII stringSubject name or common name on certificatethumbprint
hex stringA sequence of bytes, expressed as hexadecimal, used toidentify a public key by its SHA-1 digest.
The thumbprint
is sometimes referred to as afingerprint
.
When using the system SSL certificate store, OCSP (OnlineCertificate Status Protocol) is used to validate the revocationstatus of certificates.
New in version 4.2: Available on Windows and macOS as an alternative to—tlsClusterFile
.
—tlsClusterFile
and —tlsClusterCertificateSelector
options are mutually exclusive. You can onlyspecify one.
Specifies a certificate property in order to select a matchingcertificate from the operating system’s certificate store to use forinternal authentication.
—tlsClusterCertificateSelector
accepts an argument of the format <property>=<value>
where the property can be one of the following:
PropertyValue typeDescriptionsubject
ASCII stringSubject name or common name on certificatethumbprint
hex stringA sequence of bytes, expressed as hexadecimal, used toidentify a public key by its SHA-1 digest.
The thumbprint
is sometimes referred to as afingerprint
.
New in version 4.2.
Specifies the password to de-crypt the x.509 certificate-key filespecified with —tlsClusterFile
. Use the —tlsClusterPassword
option onlyif the certificate-key file is encrypted. In all cases, the mongodwill redact the password from all logging and reporting output.
Starting in MongoDB 4.0:
- On Linux/BSD, if the private key in the x.509 file is encrypted andyou do not specify the
—tlsClusterPassword
option, MongoDB will prompt for apassphrase. See TLS/SSL Certificate Passphrase. - On macOS or Windows, if the private key in the x.509 file isencrypted, you must explicitly specify the
—tlsClusterPassword
option.Alternatively, you can either use a certificate from the securesystem store (see—tlsClusterCertificateSelector
) instead of a cluster PEM file oruse an unencrypted PEM file.For more information about TLS and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
New in version 4.2.
Specifies the .pem
file that contains the root certificate chainfrom the Certificate Authority. Specify the file name of the.pem
file using relative or absolute paths.
Starting in 4.0, on macOS or Windows, you can use a certificate fromthe operating system’s secure store instead of a PEM key file. See—tlsCertificateSelector
. When using the secure store, youdo not need to, but can, also specify the —tlsCAFile
.
For more information about TLS and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
New in version 4.2.
Specifies the .pem
file that contains the root certificate chainfrom the Certificate Authority used to validate the certificatepresented by a client establishing a connection. Specify the filename of the .pem
file using relative or absolute paths.
If —tlsClusterCAFile
does not specify the .pem
file for validating thecertificate from a client establishing a connection, the cluster usesthe .pem
file specified in the —tlsCAFile
option.
—tlsClusterCAFile
lets you use separate Certificate Authorities to verify theclient to server and server to client portions of the TLS handshake.
Starting in 4.0, on macOS or Windows, you can use a certificate fromthe operating system’s secure store instead of a PEM key file. See—tlsClusterCertificateSelector
. When using the secure store, youdo not need to, but can, also specify the —tlsClusterCAFile
.
Requires that —tlsCAFile
is set.
For more information about TLS and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
New in version 4.2.
Specifies the the .pem
file that contains the Certificate RevocationList. Specify the file name of the .pem
file using relative orabsolute paths.
Note
Starting in MongoDB 4.0, you cannot specify —tlsCRLFile
on macOS. Use —tlsCertificateSelector
instead.
For more information about TLS and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
New in version 4.2.
Bypasses the validation checks for TLS certificates on otherservers in the cluster and allows the use of invalid certificates toconnect.
Note
If you specify—tlsAllowInvalidCertificates
or tls.allowInvalidCertificates:true
when using x.509 authentication, an invalid certificate isonly sufficient to establish a TLS connection but isinsufficient for authentication.
When usingthe —tlsAllowInvalidCertificates
setting, MongoDBlogs a warning regarding the use of the invalid certificate.
For more information about TLS and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
New in version 4.2.
Disables the validation of the hostnames in TLS certificates,when connecting to other members of the replica set or sharded clusterfor inter-process authentication. This allows mongod to connectto other members if the hostnames in their certificates do not matchtheir configured hostname.
For more information about TLS and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
New in version 4.2.
For clients that do not present certificates, mongod bypassesTLS/SSL certificate validation when establishing the connection.
For clients that present a certificate, however, mongod performscertificate validation using the root certificate chain specified by—tlsCAFile
and reject clients with invalid certificates.
Use the —tlsAllowConnectionsWithoutCertificates
option if you have a mixed deployment that includesclients that do not or cannot present certificates to the mongod.
For more information about TLS and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
New in version 4.2.
Prevents a MongoDB server running with TLS from acceptingincoming connections that use a specific protocol or protocols. Tospecify multiple protocols, use a comma separated list of protocols.
—tlsDisabledProtocols
recognizes the following protocols: TLS1_0
, TLS1_1
,TLS1_2
, and starting in version 4.0.4 (and 3.6.9), TLS1_3
.
- On macOS, you cannot disable
TLS1_1
and leave bothTLS1_0
andTLS1_2
enabled. You must disable at least one of the othertwo, for example,TLS1_0,TLS1_1
. - To list multiple protocols, specify as a comma separated list ofprotocols. For example
TLS1_0,TLS1_1
. - Specifying an unrecognized protocol will prevent the server fromstarting.
- The specified disabled protocols overrides any default disabledprotocols.Starting in version 4.0, MongoDB disables the use of TLS 1.0 if TLS1.1+ is available on the system. To enable the disabled TLS 1.0,specify
none
to—tlsDisabledProtocols
. See Disable TLS 1.0.
Members of replica sets and sharded clusters must speak at least oneprotocol in common.
See also
New in version 4.2.
Directs the mongod to use the FIPS mode of the TLSlibrary. Your system must have a FIPScompliant library to use the —tlsFIPSMode
option.
Note
FIPS-compatible TLS/SSL isavailable only in MongoDB Enterprise. SeeConfigure MongoDB for FIPS for more information.
SSL Options (Deprecated)
Important
All SSL options are deprecated since 4.2. Use the TLS counterparts instead, as they have identical functionality to theSSL options. The SSL protocol is deprecated and MongoDB supports TLS 1.0and later.
See
Configure mongod and mongos for TLS/SSL for fulldocumentation of MongoDB’s support.
Deprecated since version 2.6: Use —tlsMode requireTLS
instead.
Enables TLS/SSL for mongod.
With —sslOnNormalPorts
, a mongod requires TLS/SSL encryption for allconnections on the default MongoDB port, or the port specified by—port
. By default, —sslOnNormalPorts
isdisabled.
For more information about TLS/SSL and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
Deprecated since version 4.2: Use —tlsMode
instead.
New in version 2.6.
Enables TLS/SSL or mixed TLS/SSL used for all network connections. Theargument to the —sslMode
option can be one of the following:
ValueDescriptiondisabled
The server does not use TLS/SSL.allowSSL
Connections between servers do not use TLS/SSL. For incomingconnections, the server accepts both TLS/SSL and non-TLS/non-SSL.preferSSL
Connections between servers use TLS/SSL. For incomingconnections, the server accepts both TLS/SSL and non-TLS/non-SSL.requireSSL
The server uses and accepts only TLS/SSL encrypted connections.
Starting in version 3.4, if —tlsCAFile
/net.tls.CAFile
(ortheir aliases —sslCAFile
/net.ssl.CAFile
) is not specifiedand you are not using x.509 authentication, the system-wide CAcertificate store will be used when connecting to an TLS/SSL-enabledserver.
To use x.509 authentication, —tlsCAFile
or net.tls.CAFile
must be specified unless using —tlsCertificateSelector
or—net.tls.certificateSelector
. Or if using the ssl
aliases,—sslCAFile
or net.ssl.CAFile
must be specified unless using—sslCertificateSelector
or net.ssl.certificateSelector
.
For more information about TLS/SSL and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
Deprecated since version 4.2: Use —tlsCertificateKeyFile
instead.
Note
Starting in 4.0, on macOS or Windows, you can use a certificate fromthe operating system’s secure store instead of a PEM file. See—sslCertificateSelector
.
Specifies the .pem
file that contains both the TLS/SSL certificateand key.
- On Linux/BSD, you must specify
—sslPEMKeyFile
when TLS/SSL is enabled. - On Windows or macOS, you must specify either
—sslPEMKeyFile
or—sslCertificateSelector
when TLS/SSL is enabled.For more information about TLS/SSL and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
Deprecated since version 4.2: Use —tlsCertificateKeyFilePassword
instead.
Specifies the password to de-crypt the certificate-key file (i.e.—sslPEMKeyFile
). Use the —sslPEMKeyPassword
option only if thecertificate-key file is encrypted. In all cases, the mongod willredact the password from all logging and reporting output.
Starting in MongoDB 4.0:
- On Linux/BSD, if the private key in the PEM file is encrypted andyou do not specify the
—sslPEMKeyPassword
option, MongoDB will prompt for apassphrase. See TLS/SSL Certificate Passphrase. - On macOS or Windows, if the private key in the PEM file isencrypted, you must explicitly specify the
—sslPEMKeyPassword
option.Alternatively, you can use a certificate from the secure systemstore (see—sslCertificateSelector
) instead of a PEM key file or use anunencrypted PEM file.For more information about TLS/SSL and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
Deprecated since version 4.2: Use —tlsClusterFile
instead.
Note
Starting in 4.0, on macOS or Windows, you can use a certificatefrom the operating system’s secure store instead of a PEM keyfile. See —sslClusterCertificateSelector
.
Specifies the .pem
file that contains the x.509 certificate-keyfile for membership authenticationfor the cluster or replica set.
If —sslClusterFile
does not specify the .pem
file for internal clusterauthentication or the alternative—sslClusterCertificateSelector
, the cluster uses the.pem
file specified in the —sslPEMKeyFile
option orthe certificate returned by the —sslCertificateSelector
.
To use x.509 authentication, —tlsCAFile
or net.tls.CAFile
must be specified unless using —tlsCertificateSelector
or—net.tls.certificateSelector
. Or if using the ssl
aliases,—sslCAFile
or net.ssl.CAFile
must be specified unless using—sslCertificateSelector
or net.ssl.certificateSelector
.
For more information about TLS/SSL and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
Deprecated since version 4.2: Use —tlsCertificateSelector
instead.
New in version 4.0: Available on Windows and macOS as an alternative to —tlsCertificateKeyFile
.
—tlsCertificateKeyFile
and —sslCertificateSelector
options are mutually exclusive. You can onlyspecify one.
Specifies a certificate property in order to select a matchingcertificate from the operating system’s certificate store.
—sslCertificateSelector
accepts an argument of the format <property>=<value>
where the property can be one of the following:
PropertyValue typeDescriptionsubject
ASCII stringSubject name or common name on certificatethumbprint
hex stringA sequence of bytes, expressed as hexadecimal, used toidentify a public key by its SHA-1 digest.
The thumbprint
is sometimes referred to as afingerprint
.
When using the system SSL certificate store, OCSP (OnlineCertificate Status Protocol) is used to validate the revocationstatus of certificates.
Deprecated since version 4.2: Use —tlsClusterCertificateSelector
instead.
New in version 4.0: Available on Windows and macOS as an alternative to—sslClusterFile
.
—sslClusterFile
and —sslClusterCertificateSelector
options are mutually exclusive. You can onlyspecify one.
Specifies a certificate property in order to select a matchingcertificate from the operating system’s certificate store to use forinternal authentication.
—sslClusterCertificateSelector
accepts an argument of the format <property>=<value>
where the property can be one of the following:
PropertyValue typeDescriptionsubject
ASCII stringSubject name or common name on certificatethumbprint
hex stringA sequence of bytes, expressed as hexadecimal, used toidentify a public key by its SHA-1 digest.
The thumbprint
is sometimes referred to as afingerprint
.
Deprecated since version 4.2: Use —tlsClusterPassword
instead.
New in version 2.6.
Specifies the password to de-crypt the x.509 certificate-key filespecified with —sslClusterFile
. Use the —sslClusterPassword
option onlyif the certificate-key file is encrypted. In all cases, the mongodwill redact the password from all logging and reporting output.
Starting in MongoDB 4.0:
- On Linux/BSD, if the private key in the x.509 file is encrypted andyou do not specify the
—sslClusterPassword
option, MongoDB will prompt for apassphrase. See TLS/SSL Certificate Passphrase. - On macOS or Windows, if the private key in the x.509 file isencrypted, you must explicitly specify the
—sslClusterPassword
option.Alternatively, you can either use a certificate from the securesystem store (see—sslClusterCertificateSelector
) instead of a cluster PEM file oruse an unencrypted PEM file.For more information about TLS/SSL and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
Deprecated since version 4.2: Use —tlsCAFile
instead.
Specifies the .pem
file that contains the root certificate chainfrom the Certificate Authority. Specify the file name of the.pem
file using relative or absolute paths.
Starting in 4.0, on macOS or Windows, you can use a certificate fromthe operating system’s secure store instead of a PEM key file. See—sslCertificateSelector
. When using the secure store, youdo not need to, but can, also specify the —sslCAFile
.
For more information about TLS/SSL and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
Deprecated since version 4.2: Use —tlsClusterCAFile
instead.
Specifies the .pem
file that contains the root certificate chainfrom the Certificate Authority used to validate the certificatepresented by a client establishing a connection. Specify the filename of the .pem
file using relative or absolute paths.
If —sslClusterCAFile
does not specify the .pem
file for validating thecertificate from a client establishing a connection, the cluster usesthe .pem
file specified in the —sslCAFile
option.
—sslClusterCAFile
lets you use separate Certificate Authorities to verify theclient to server and server to client portions of the TLS handshake.
Starting in 4.0, on macOS or Windows, you can use a certificate fromthe operating system’s secure store instead of a PEM key file. See—sslClusterCertificateSelector
. When using the secure store, youdo not need to, but can, also specify the —sslClusterCAFile
.
Requires that —sslCAFile
is set.
For more information about TLS/SSL and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
Deprecated since version 4.2: Use —tlsCRLFile
instead.
Specifies the the .pem
file that contains the Certificate RevocationList. Specify the file name of the .pem
file using relative orabsolute paths.
Note
Starting in MongoDB 4.0, you cannot specify —sslCRLFile
on macOS. Use —sslCertificateSelector
instead.
For more information about TLS/SSL and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
Deprecated since version 4.2: Use —tlsAllowInvalidCertificates
instead.
Bypasses the validation checks for TLS/SSL certificates on otherservers in the cluster and allows the use of invalid certificates toconnect.
Note
Starting in MongoDB 4.0, if you specify—sslAllowInvalidCertificates
ornet.ssl.allowInvalidCertificates: true
(or in MongoDB 4.2, thealias —tlsAllowInvalidateCertificates
ornet.tls.allowInvalidCertificates: true
) when using x.509authentication, an invalid certificate is only sufficient toestablish a TLS/SSL connection but is insufficient forauthentication.
When usingthe —sslAllowInvalidCertificates
setting, MongoDBlogs a warning regarding the use of the invalid certificate.
For more information about TLS/SSL and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
Deprecated since version 4.2: Use —tlsAllowInvalidHostnames
instead.
New in version 3.0.
Disables the validation of the hostnames in TLS/SSL certificates,when connecting to other members of the replica set or sharded clusterfor inter-process authentication. This allows mongod to connectto other members if the hostnames in their certificates do not matchtheir configured hostname.
For more information about TLS/SSL and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
Deprecated since version 4.2: Use —tlsAllowConnectionsWithoutCertificates
instead.
For clients that do not present certificates, mongod bypassesTLS/SSL certificate validation when establishing the connection.
For clients that present a certificate, however, mongod performscertificate validation using the root certificate chain specified by—sslCAFile
and reject clients with invalid certificates.
Use the —sslAllowConnectionsWithoutCertificates
option if you have a mixed deployment that includesclients that do not or cannot present certificates to the mongod.
For more information about TLS/SSL and MongoDB, seeConfigure mongod and mongos for TLS/SSL andTLS/SSL Configuration for Clients .
Deprecated since version 4.2: Use —tlsDisabledProtocols
instead.
New in version 3.0.7.
Prevents a MongoDB server running with TLS/SSL from acceptingincoming connections that use a specific protocol or protocols. Tospecify multiple protocols, use a comma separated list of protocols.
—sslDisabledProtocols
recognizes the following protocols: TLS1_0
, TLS1_1
,TLS1_2
, and starting in version 4.0.4 (and 3.6.9), TLS1_3
.
- On macOS, you cannot disable
TLS1_1
and leave bothTLS1_0
andTLS1_2
enabled. You must disable at least one of the othertwo, for example,TLS1_0,TLS1_1
. - To list multiple protocols, specify as a comma separated list ofprotocols. For example
TLS1_0,TLS1_1
. - Specifying an unrecognized protocol will prevent the server fromstarting.
- The specified disabled protocols overrides any default disabledprotocols.Starting in version 4.0, MongoDB disables the use of TLS 1.0 if TLS1.1+ is available on the system. To enable the disabled TLS 1.0,specify
none
to—sslDisabledProtocols
. See Disable TLS 1.0.
Members of replica sets and sharded clusters must speak at least oneprotocol in common.
See also
Deprecated since version 4.2: Use —tlsFIPSMode
instead.
Directs the mongod to use the FIPS mode of the TLS/SSLlibrary. Your system must have a FIPScompliant library to use the —sslFIPSMode
option.
Note
FIPS-compatible TLS/SSL isavailable only in MongoDB Enterprise. SeeConfigure MongoDB for FIPS for more information.
Profiler Options
Configures the database profiler level.The following profiler levels are available:
LevelDescription0
The profiler is off and does not collect any data.This is the default profiler level.1
The profiler collects data for operations that take longerthan the value of slowms
.2
The profiler collects data for all operations.
Important
Profiling can impact performance and shares settings with the systemlog. Carefully consider any performance and security implicationsbefore configuring and enabling the profiler on a productiondeployment.
See Profiler Overhead for more information onpotential performance degradation.
The slow operation time threshold, in milliseconds. Operationsthat run for longer than this threshold are considered slow.
When logLevel
is set to 0
, MongoDB records _slow_operations to the diagnostic log at a rate determined byslowOpSampleRate
. Starting in MongoDB4.2, the secondaries of replica sets log all oplog entry messagesthat take longer than the slow operation threshold to apply regardless of the sample rate.
At higher logLevel
settings, all operations appear inthe diagnostic log regardless of their latency with the followingexception: the logging of slow oplog entry messages by thesecondaries. The secondaries log only the slow oplogentries; increasing the logLevel
does not log alloplog entries.
For mongod
instances, —slowms
affects the diagnostic logand, if enabled, the profiler.
See also
The fraction of slow operations that should be profiled or logged.—slowOpSampleRate
accepts values between 0 and 1, inclusive.
—slowOpSampleRate
does not affect the slow oplog entry logging by the secondary members of a replica set. Secondarymembers log all oplog entries that take longer than the slowoperation threshold regardless of the —slowOpSampleRate
.
For mongod
instances, —slowOpSampleRate
affects thediagnostic log and, if enabled, the profiler.
Audit Options
—auditDestination
- Enables auditing and specifies wheremongod sends all audit events.
—auditDestination
can have one of the following values:
ValueDescriptionsyslog
Output the audit events to syslog in JSON format. Not available onWindows. Audit messages have a syslog severity level of info
and a facility level of user
.
The syslog message limit can result in the truncation ofaudit messages. The auditing system will neither detect thetruncation nor error upon its occurrence.console
Output the audit events to stdout
in JSON format.file
Output the audit events to the file specified in—auditPath
in the format specified in—auditFormat
.
Note
Available only in MongoDB Enterpriseand MongoDB Atlas.
New in version 2.6.
Specifies the format of the output file for auditing if —auditDestination
is file
. The—auditFormat
option can have one of the following values:
ValueDescriptionJSON
Output the audit events in JSON format to the file specifiedin —auditPath
.BSON
Output the audit events in BSON binary format to the filespecified in —auditPath
.
Printing audit events to a file in JSON format degrades serverperformance more than printing to a file in BSON format.
Note
Available only in MongoDB Enterpriseand MongoDB Atlas.
New in version 2.6.
Specifies the output file for auditing if—auditDestination
has value of file
. The —auditPath
option can take either a full path name or a relative path name.
Note
Available only in MongoDB Enterpriseand MongoDB Atlas.
New in version 2.6.
Specifies the filter to limit the types of operations the audit system records. The option takes a string representationof a query document of the form:
- { <field1>: <expression1>, ... }
The <field>
can be any field in the audit message, including fields returned in theparam document. The<expression>
is a query condition expression.
To specify an audit filter, enclose the filter document in singlequotes to pass the document as a string.
To specify the audit filter in a configuration file, you must use the YAML format ofthe configuration file.
Note
Available only in MongoDB Enterpriseand MongoDB Atlas.
SNMP Options
Note
MongoDB Enterprise on macOS does not include support for SNMP dueto SERVER-29352.
—snmp-disabled
- Disables SNMP access to
mongod
. The option is incompatiblewith—snmp-subagent
and—snmp-master
.
New in version 4.0.6.
—snmp-subagent
- Runs SNMP as a subagent. The option is incompatible with
—snmp-disabled
.
—snmp-master
- Runs SNMP as a master. The option is incompatible with
—snmp-disabled
.
See also
inMemory Options
Changed in version 3.4: Values can range from 256MB to 10TB and can be a float.
Maximum amount of memory to allocate for in-memory storageengine data, including indexes, oplog if themongod
is part of replica set, replica set or shardedcluster metadata, etc.
By default, the in-memory storage engine uses 50% of physical RAM minus1 GB.
Enterprise Feature
Available in MongoDB Enterprise only.
Encryption Key Management Options
New in version 3.2.
Enables encryption for the WiredTiger storage engine. You must setto true
to pass in encryption keys and configurations.
Enterprise Feature
Available in MongoDB Enterprise only.
New in version 3.2.
The cipher mode to use for encryption at rest:
ModeDescriptionAES256-CBC
256-bit Advanced Encryption Standard in Cipher Block ChainingModeAES256-GCM
256-bit Advanced Encryption Standard in Galois/Counter Mode
Changed in version 4.0: MongoDB Enterprise on Windows no longer supports AES256-GCM
. Thiscipher is now available only on Linux.
Enterprise Feature
Available in MongoDB Enterprise only.
New in version 3.2.
The path to the local keyfile when managing keys via process otherthan KMIP. Only set when managing keys via process other than KMIP.If data is already encrypted using KMIP, MongoDB will throw an error.
The keyfile can contain only a single key. The key is either a 16 or32 character string.
Requires enableEncryption
to be true
.
Enterprise Feature
Available in MongoDB Enterprise only.
New in version 3.2.
Unique KMIP identifier for an existing key within the KMIP server.Include to use the key associated with the identifier as the systemkey. You can only use the setting the first time you enableencryption for the mongod
instance. RequiresenableEncryption
to be true.
If unspecified, MongoDB will request that the KMIP server create anew key to utilize as the system key.
If the KMIP server cannot locate a key with the specified identifieror the data is already encrypted with a key, MongoDB will throw anerror
Enterprise Feature
Available in MongoDB Enterprise only.
New in version 3.2.
If true, rotate the master key and re-encrypt the internalkeystore.
Enterprise Feature
Available in MongoDB Enterprise only.
See also
New in version 3.2.
Hostname or IP address of key management solution running a KMIPserver. Requires enableEncryption
to be true.
When connecting to the KMIP server, the mongod
verifies that the specified —kmipServerName
matches the Subject AlternativeName SAN
(or, if SAN
is not present, the Common Name CN
)in the certificate presented by the KMIP server. If SAN
ispresent, mongod
does not match against the CN
. Ifthe hostname does not match the SAN
(or CN
), themongod
will fail to connect.
Starting in MongoDB 4.2, when performing comparison of SAN, MongoDBsupports comparison of DNS names or IP addresses. In previous versions,MongoDB only supports comparisons of DNS names.
Enterprise Feature
Available in MongoDB Enterprise only.
New in version 3.2.
Port number the KMIP server is listening on. Requires that akmipServerName
be provided. RequiresenableEncryption
to be true.
Enterprise Feature
Available in MongoDB Enterprise only.
New in version 4.0: Available on Windows and macOS as an alternative to—kmipClientCertificateFile
.
—kmipClientCertificateFile
and —kmipClientCertificateSelector
options are mutually exclusive. You can onlyspecify one.
Specifies a certificate property in order to select a matchingcertificate from the operating system’s certificate store toauthenticate MongoDB to the KMIP server.
—kmipClientCertificateSelector
accepts an argument of the format <property>=<value>
where the property can be one of the following:
PropertyValue typeDescriptionsubject
ASCII stringSubject name or common name on certificatethumbprint
hex stringA sequence of bytes, expressed as hexadecimal, used toidentify a public key by its SHA-1 digest.
The thumbprint
is sometimes referred to as afingerprint
.
Enterprise Feature
Available in MongoDB Enterprise only.
New in version 3.2.
String containing the path to the client certificate used forauthenticating MongoDB to the KMIP server. Requires that akmipServerName
be provided.
Note
Starting in 4.0, on macOS or Windows, you can use a certificatefrom the operating system’s secure store instead of a PEM keyfile. See —kmipClientCertificateSelector
.
Enterprise Feature
Available in MongoDB Enterprise only.
New in version 3.2.
The password (if one exists) for the client certificate passed intokmipClientCertificateFile
. Is used forauthenticating MongoDB to the KMIP server. Requires that akmipClientCertificateFile
be provided.
Enterprise Feature
Available in MongoDB Enterprise only.
New in version 3.2.
Path to CA File. Used for validating secure client connection toKMIP server.
Note
Starting in 4.0, on macOS or Windows, you can use a certificatefrom the operating system’s secure store instead of a PEM keyfile. See —kmipClientCertificateSelector
. When using the secure store, you do notneed to, but can, also specify the —kmipServerCAFile
.
New in version 4.2.
Roll over the encrypted storage engine database keys configured withAES256-GCM
cipher.
When mongod
instance is started with this option, theinstance rotates the keys and exits.
Enterprise Feature
Available in MongoDB Enterprise only.