Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

603 lines (412 sloc) 16.762 kB
==========================
Configuration File Options
==========================
.. default-domain:: mongodb
.. important::
.. versionchanged:: 2.6
MongoDB introduces a YAML-based configuration file format.
The :v2.4:`2.4 configuration file format
</reference/configuration-options>` remains for backward
compatibility.
Overview
--------
You can configure :program:`mongod` and :program:`mongos` instances at
startup using a configuration file. The configuration file contains
settings that are equivalent to the :program:`mongod` and
:program:`mongos` command-line options.
Using a configuration file makes managing :program:`mongod` and
:program:`mongos` options easier, especially for large-scale
deployments. You can also add comments to the configuration file to
explain the server's settings.
If you installed from a package and have started MongoDB using your
system's :term:`control script`, you are already using a configuration
file.
Configuration File
------------------
File Format
~~~~~~~~~~~
.. versionchanged:: 2.6
The configuration file is in `YAML <http://www.yaml.org>`_ format. For
example, the following contains various
:program:`mongod` configuration settings in YAML format:
.. note::
YAML does not accept tabs; use spaces instead.
.. code-block:: yaml
systemLog:
destination: file
path: "/var/log/mongodb/mongodb.log"
logAppend: true
storage:
journal:
enabled: true
processManagement:
fork: true
net:
bindIp: 127.0.0.1
port: 27017
setParameter:
enableLocalhostAuthBypass: false
...
Use the Configuration File
~~~~~~~~~~~~~~~~~~~~~~~~~~
To start :program:`mongod` or :program:`mongos` using a config file,
specify the config file with the :option:`--config` option or the
:option:`-f` option, as in the following examples:
The following examples use the :option:`--config` option for
:program:`mongod` and :program:`mongos`:
.. code-block:: sh
mongod --config /etc/mongod.conf
mongos --config /etc/mongos.conf
You can also use the :option:`-f` alias to specify the configuration
file, as in the following:
.. code-block:: sh
mongod -f /etc/mongod.conf
mongos -f /etc/mongos.conf
If you installed from a package and have started MongoDB using your
system's :term:`control script`, you are already using a configuration
file.
Core Options
------------
``systemLog`` Options
~~~~~~~~~~~~~~~~~~~~~
.. code-block:: yaml
systemLog:
verbosity: <int>
quiet: <boolean>
traceAllException: <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
.. include:: /includes/option/setting-conf-systemLog.verbosity.rst
.. include:: /includes/option/setting-conf-systemLog.quiet.rst
.. include:: /includes/option/setting-conf-systemLog.traceAllExceptions.rst
.. include:: /includes/option/setting-conf-systemLog.syslogFacility.rst
.. include:: /includes/option/setting-conf-systemLog.path.rst
.. include:: /includes/option/setting-conf-systemLog.logAppend.rst
.. include:: /includes/option/setting-conf-systemLog.logRotate.rst
.. include:: /includes/option/setting-conf-systemLog.destination.rst
.. include:: /includes/option/setting-conf-systemLog.timeStampFormat.rst
``systemLog.component`` Options
```````````````````````````````
.. code-block:: yaml
systemLog:
component:
accessControl:
verbosity: <int>
command:
verbosity: <int>
# COMMENT some component verbosity settings omitted for brevity
storage:
verbosity: <int>
journal:
verbosity: <int>
write:
verbosity: <int>
.. include:: /includes/option/setting-conf-systemLog.component.accessControl.verbosity.rst
.. include:: /includes/option/setting-conf-systemLog.component.command.verbosity.rst
.. include:: /includes/option/setting-conf-systemLog.component.control.verbosity.rst
.. include:: /includes/option/setting-conf-systemLog.component.geo.verbosity.rst
.. include:: /includes/option/setting-conf-systemLog.component.index.verbosity.rst
.. include:: /includes/option/setting-conf-systemLog.component.network.verbosity.rst
.. include:: /includes/option/setting-conf-systemLog.component.query.verbosity.rst
.. include:: /includes/option/setting-conf-systemLog.component.replication.verbosity.rst
.. include:: /includes/option/setting-conf-systemLog.component.sharding.verbosity.rst
.. include:: /includes/option/setting-conf-systemLog.component.storage.verbosity.rst
.. include:: /includes/option/setting-conf-systemLog.component.storage.journal.verbosity.rst
.. include:: /includes/option/setting-conf-systemLog.component.write.verbosity.rst
``processManagement`` Options
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: yaml
processManagement:
fork: <boolean>
pidFilePath: <string>
.. include:: /includes/option/setting-conf-processManagement.fork.rst
.. include:: /includes/option/setting-conf-processManagement.pidFilePath.rst
``net`` Options
~~~~~~~~~~~~~~~
.. code-block:: yaml
net:
port: <int>
bindIp: <string>
maxIncomingConnections: <int>
wireObjectCheck: <boolean>
ipv6: <boolean>
unixDomainSocket:
enabled: <boolean>
pathPrefix: <string>
filePermissions: <int>
http:
enabled: <boolean>
JSONPEnabled: <boolean>
RESTInterfaceEnabled: <boolean>
ssl:
sslOnNormalPorts: <boolean> # deprecated since 2.6
mode: <string>
PEMKeyFile: <string>
PEMKeyPassword: <string>
clusterFile: <string>
clusterPassword: <string>
CAFile: <string>
CRLFile: <string>
allowConnectionsWithoutCertificates: <boolean>
allowInvalidCertificates: <boolean>
allowInvalidHostnames: <boolean>
FIPSMode: <boolean>
.. include:: /includes/option/setting-conf-net.port.rst
.. include:: /includes/option/setting-conf-net.bindIp.rst
.. include:: /includes/option/setting-conf-net.maxIncomingConnections.rst
.. include:: /includes/option/setting-conf-net.wireObjectCheck.rst
.. include:: /includes/option/setting-conf-net.ipv6.rst
.. PENDING SERVER-13097
.. include:: /includes/option/setting-conf-net.http.port.rst
``net.unixDomainSocket`` Options
````````````````````````````````
.. code-block:: yaml
net:
unixDomainSocket:
enabled: <boolean>
pathPrefix: <string>
filePermissions: <int>
.. include:: /includes/option/setting-conf-net.unixDomainSocket.enabled.rst
.. include:: /includes/option/setting-conf-net.unixDomainSocket.pathPrefix.rst
.. include:: /includes/option/setting-conf-net.unixDomainSocket.filePermissions.rst
``net.http`` Options
````````````````````
.. code-block:: yaml
net:
http:
enabled: <boolean>
JSONPEnabled: <boolean>
RESTInterfaceEnabled: <boolean>
.. include:: /includes/warning-http-interface.rst
.. include:: /includes/option/setting-conf-net.http.enabled.rst
.. include:: /includes/option/setting-conf-net.http.JSONPEnabled.rst
.. include:: /includes/option/setting-conf-net.http.RESTInterfaceEnabled.rst
``net.ssl`` Options
```````````````````
.. code-block:: yaml
net:
ssl:
sslOnNormalPorts: <boolean> # deprecated since 2.6
mode: <string>
PEMKeyFile: <string>
PEMKeyPassword: <string>
clusterFile: <string>
clusterPassword: <string>
CAFile: <string>
CRLFile: <string>
allowConnectionsWithoutCertificates: <boolean>
allowInvalidCertificates: <boolean>
allowInvalidHostnames: <boolean>
FIPSMode: <boolean>
.. include:: /includes/option/setting-conf-net.ssl.sslOnNormalPorts.rst
.. include:: /includes/option/setting-conf-net.ssl.mode.rst
.. include:: /includes/option/setting-conf-net.ssl.PEMKeyFile.rst
.. include:: /includes/option/setting-conf-net.ssl.PEMKeyPassword.rst
.. include:: /includes/option/setting-conf-net.ssl.clusterFile.rst
.. include:: /includes/option/setting-conf-net.ssl.clusterPassword.rst
.. include:: /includes/option/setting-conf-net.ssl.CAFile.rst
.. include:: /includes/option/setting-conf-net.ssl.CRLFile.rst
.. include:: /includes/option/setting-conf-net.ssl.allowConnectionsWithoutCertificates.rst
.. include:: /includes/option/setting-conf-net.ssl.allowInvalidCertificates.rst
.. include:: /includes/option/setting-conf-net.ssl.allowInvalidHostnames.rst
.. include:: /includes/option/setting-conf-net.ssl.FIPSMode.rst
``security`` Options
~~~~~~~~~~~~~~~~~~~~
.. code-block:: yaml
security:
keyFile: <string>
clusterAuthMode: <string>
authorization: <string>
javascriptEnabled: <boolean>
sasl:
hostName: <string>
serviceName: <string>
saslauthdSocketPath: <string>
.. include:: /includes/option/setting-conf-security.keyFile.rst
.. include:: /includes/option/setting-conf-security.clusterAuthMode.rst
.. include:: /includes/option/setting-conf-security.authorization.rst
.. include:: /includes/option/setting-conf-security.javascriptEnabled.rst
.. Hide non-operative options pending SERVER-12892
.. include: /includes/option/setting-conf-security.authenticationMechanisms.rst
.. include: /includes/option/setting-conf-security.authSchemaVersion.rst
.. include: /includes/option/setting-conf-security.enableLocalhostAuthBypass.rst
.. include: /includes/option/setting-conf-security.supportCompatibilityFormPrivilegeDocuments.rst
``security.sasl`` Options
`````````````````````````
.. code-block:: yaml
security:
sasl:
hostName: <string>
serviceName: <string>
saslauthdSocketPath: <string>
.. include:: /includes/option/setting-conf-security.sasl.hostName.rst
.. include:: /includes/option/setting-conf-security.sasl.serviceName.rst
.. include:: /includes/option/setting-conf-security.sasl.saslauthdSocketPath.rst
``setParameter`` Option
~~~~~~~~~~~~~~~~~~~~~~~
.. include:: /includes/option/setting-conf-setParameter.rst
``storage`` Options
~~~~~~~~~~~~~~~~~~~
.. code-block:: yaml
storage:
dbPath: <string>
indexBuildRetry: <boolean>
repairPath: <string>
journal:
enabled: <boolean>
directoryPerDB: <boolean>
syncPeriodSecs: <int>
engine: <string>
mmapv1:
preallocDataFiles: <boolean>
nsSize: <int>
quota:
enforced: <boolean>
maxFilesPerDB: <int>
smallFiles: <boolean>
journal:
debugFlags: <int>
commitIntervalMs: <num>
wiredTiger:
engineConfig:
cacheSizeGB: <number>
statisticsLogDelaySecs: <number>
journalCompressor: <string>
directoryForIndexes: <boolean>
collectionConfig:
blockCompressor: <string>
indexConfig:
prefixCompression: <boolean>
.. include:: /includes/option/setting-conf-storage.dbPath.rst
.. include:: /includes/option/setting-conf-storage.indexBuildRetry.rst
.. include:: /includes/option/setting-conf-storage.repairPath.rst
.. include:: /includes/option/setting-conf-storage.journal.enabled.rst
.. include:: /includes/option/setting-conf-storage.directoryPerDB.rst
.. include:: /includes/option/setting-conf-storage.syncPeriodSecs.rst
.. include:: /includes/option/setting-conf-storage.engine.rst
``storage.mmapv1`` Options
``````````````````````````
.. code-block:: yaml
storage:
mmapv1:
preallocDataFiles: <boolean>
nsSize: <int>
quota:
enforced: <boolean>
maxFilesPerDB: <int>
smallFiles: <boolean>
journal:
debugFlags: <int>
commitIntervalMs: <num>
.. include:: /includes/option/setting-conf-storage.mmapv1.preallocDataFiles.rst
.. include:: /includes/option/setting-conf-storage.mmapv1.nsSize.rst
.. include:: /includes/option/setting-conf-storage.mmapv1.quota.enforced.rst
.. include:: /includes/option/setting-conf-storage.mmapv1.quota.maxFilesPerDB.rst
.. include:: /includes/option/setting-conf-storage.mmapv1.smallFiles.rst
.. include:: /includes/option/setting-conf-storage.mmapv1.journal.debugFlags.rst
.. include:: /includes/option/setting-conf-storage.mmapv1.journal.commitIntervalMs.rst
``storage.wiredTiger`` Options
``````````````````````````````
.. code-block:: yaml
storage:
wiredTiger:
engineConfig:
cacheSizeGB: <number>
statisticsLogDelaySecs: <number>
journalCompressor: <string>
directoryForIndexes: <boolean>
collectionConfig:
blockCompressor: <string>
indexConfig:
prefixCompression: <boolean>
.. include:: /includes/option/setting-conf-storage.wiredTiger.engineConfig.cacheSizeGB.rst
.. include:: /includes/option/setting-conf-storage.wiredTiger.engineConfig.statisticsLogDelaySecs.rst
.. include:: /includes/option/setting-conf-storage.wiredTiger.engineConfig.journalCompressor.rst
.. include:: /includes/option/setting-conf-storage.wiredTiger.engineConfig.directoryForIndexes.rst
.. include:: /includes/option/setting-conf-storage.wiredTiger.collectionConfig.blockCompressor.rst
.. include:: /includes/option/setting-conf-storage.wiredTiger.indexConfig.prefixCompression.rst
``operationProfiling`` Options
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: yaml
operationProfiling:
slowOpThresholdMs: <int>
mode: <string>
.. include:: /includes/option/setting-conf-operationProfiling.slowOpThresholdMs.rst
.. include:: /includes/option/setting-conf-operationProfiling.mode.rst
``replication`` Options
~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: yaml
replication:
oplogSizeMB: <int>
replSetName: <string>
secondaryIndexPrefetch: <string>
.. include:: /includes/option/setting-conf-replication.oplogSizeMB.rst
.. include:: /includes/option/setting-conf-replication.replSetName.rst
.. include:: /includes/option/setting-conf-replication.secondaryIndexPrefetch.rst
``sharding`` Options
~~~~~~~~~~~~~~~~~~~~
.. code-block:: yaml
sharding:
clusterRole: <string>
archiveMovedChunks: <boolean>
.. include:: /includes/option/setting-conf-sharding.clusterRole.rst
.. include:: /includes/option/setting-conf-sharding.archiveMovedChunks.rst
``auditLog`` Options
~~~~~~~~~~~~~~~~~~~~
.. include:: /includes/note-audit-in-enterprise-only.rst
.. code-block:: yaml
auditLog:
destination: <string>
format: <string>
path: <string>
filter: <string>
.. include:: /includes/option/setting-conf-auditLog.destination.rst
.. include:: /includes/option/setting-conf-auditLog.format.rst
.. include:: /includes/option/setting-conf-auditLog.path.rst
.. include:: /includes/option/setting-conf-auditLog.filter.rst
``snmp`` Options
~~~~~~~~~~~~~~~~
.. code-block:: yaml
snmp:
subagent: <boolean>
master: <boolean>
.. include:: /includes/option/setting-conf-snmp.subagent.rst
.. include:: /includes/option/setting-conf-snmp.master.rst
``mongos``\ -only Options
-------------------------
.. code-block:: yaml
replication:
localPingThresholdMs: <boolean>
sharding:
autoSplit: <boolean>
configDB: <string>
chunkSize: <int>
.. include:: /includes/option/setting-conf-replication.localPingThresholdMs.rst
.. include:: /includes/option/setting-conf-sharding.autoSplit.rst
.. include:: /includes/option/setting-conf-sharding.configDB.rst
.. include:: /includes/option/setting-conf-sharding.chunkSize.rst
Windows Service Options
-----------------------
.. code-block:: yaml
processManagement:
windowsService:
serviceName: <string>
displayName: <string>
description: <string>
serviceUser: <string>
servicePassword: <string>
.. include:: /includes/option/setting-conf-processManagement.windowsService.serviceName.rst
.. include:: /includes/option/setting-conf-processManagement.windowsService.displayName.rst
.. include:: /includes/option/setting-conf-processManagement.windowsService.description.rst
.. include:: /includes/option/setting-conf-processManagement.windowsService.serviceUser.rst
.. include:: /includes/option/setting-conf-processManagement.windowsService.servicePassword.rst
Jump to Line
Something went wrong with that request. Please try again.