MongoDB parameter Description

Source: Internet
Author: User
Tags auth mongodb syslog unix domain socket
MongoDB Start Command mongod parameter description

The main parameters of Mongod are:

Basic Configuration


--quiet # quiet Output
--port Arg # Specify the service port number, default port 27017
--BIND_IP Arg # Binding Service IP, if bound, only native access, do not specify default local all IP
--logpath Arg # Specify MongoDB log file, note that the specified file is not a directory
--logappend # Write logs with an Append method
--pidfilepath Arg # The full path of PID file, if not set, then no PID files
--keyfile Arg # The full path of the private key of the cluster, valid only for the replica Set schema
--unixsocketprefix Arg # UNIX domain Socket substitution directory, (default/TMP)
--fork # run MongoDB as a daemon, creating a server process
--auth # Enable authentication
--cpu # Show CPU utilization and iowait on a regular basis
--dbpath Arg # Specify Database path
--diaglog Arg # diaglog option 0=off 1=w 2=r 3=both 7=w+some
--directoryperdb # Set each database will be saved in a separate directory
--journal # Enable logging option, MONGODB data operations will be written to the file in the Journal folder
--journaloptions Arg # Enable Logging diagnostics option
--ipv6 # Enable IPV6 option
--jsonp # Allow JSONP to be accessed via HTTP (with security implications)
--maxconns Arg # Maximum simultaneous connection number default 2000
--noauth # Do not enable validation
--nohttpinterface # Close HTTP interface, turn off 27018 port access by default
--noprealloc # Disable data file pre-allocation (often impacting performance)
--noscripting # Disable script engine
--notablescan # Do not allow table scans
--nounixsocket # Disable UNIX socket sniffing
--nssize Arg (=16) # Set letter database. ns file Size (MB)
--objcheck # in receipt of customer data, check the validity,
--profile Arg # file Parameters 0=off 1=slow, 2=all
--quota # limit the number of files per database, set defaults to 8
--quotafiles Arg # Number of files Allower per db, requires--quota
--rest # Open a simple rest API
--repair # Repair all database run repair on all DBS
--repairpath Arg # The directory of the files generated by the repair library, which defaults to the directory name DBPath
--slowms Arg (=100) # Value of slow for profile and console log
--smallfiles # Use a smaller default file
--syncdelay Arg (=60) # Number of seconds to write data to disk (0=never, not recommended)
--sysinfo # Print some diagnostic system Information
--upgrade # If you need to upgrade your database
* Replicaton Parameters


--fastsync # from a DBPath the Library Replication service is enabled, and the DBPath database is a snapshot of the master library, which can be used to quickly enable synchronization
--autoresync # If you sync data from the library to the main library, you'll automatically resynchronize,
--oplogsize Arg # Set the size of the Oplog (MB)
* Master/From Parameters


--master # Main Library Mode
--slave # from Library mode
--source Arg # from the Library port number
--only Arg # Specify a single database replication
--slavedelay Arg # Set the latency for synchronizing the main library from the library
* Replica set (replica set) option:


--replset Arg # set the replica set name
* Sharding (fragment) option

--configsvr # Declare this is a cluster config service, default port 27019, default directory/data/configdb
--shardsvr # Declare this to be a cluster fragment, default port 27018
--nomoveparanoia # off paranoia for movechunk data save

# All of the above parameters can be written to the mongod.conf configuration document for example:

DBPath =/data/mongodb
LogPath =/data/mongodb/mongodb.log
Logappend = True
Port = 27017
Fork = True
Auth = True

E.g:./mongod-shardsvr-replset Shard1-port 16161-dbpath/data/mongodb/data/shard1a-oplogsize 100-logpath/data/mongo Db/logs/shard1a.log-logappend-fork-rest

Mongod Synopsis

The Mongod is the primary daemon process for the mongodbsystem. IT handles data requests, manages data format, and Performsbackground management operations.

This document provides a complete overview the all command line OptionsFor Mongod. These options are are primarily useful for testingpurposes. In common operation, use theconfiguration fileoptions to control the behavior Ofyour database, which is fully capable of ll operations Describedbelow. Options Core Options Mongod
--help, H

Returns information on the options and use of Mongod. --version

Returns the Mongod release number. --config <filename>-F

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. 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. --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.)--quiet

Runs the Mongod in a quiet mode, attempts to limit the amountof output. This option suppresses:output from database commands replication activity connection accepted events connection closed EV Ents--port <port>


Specifies the TCP port on which the MongoDB instance listens forclient. --bind_ip <ip address>

Default:all interfaces. .. Versionchanged:: 2.6.0 The Deb andrpm packages include a default configuration file that Sets{{role}} to127.0.0.1.

Specifies the IP address of the Mongod binds to into listenfor connections from applications. You may attachmongod to Anyinterface. When Attachingmongod to a publicly accessibleinterface, ensure so you have implemented proper authentication Andfirewall Restrictions to protect the integrity of your database. --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 the connection tracking.

Changed in version 2.6:mongodb removed the upward limit on themaxincomingconnections setting. --syslog

Sends all logging output to the host ' s syslog system Ratherthan to standard output or to a log file. , as With--logpath.

The--syslog option is isn't supported on Windows. --syslogfacility <string>


Specifies the facility level used when logging messages to syslog. The value you specify must is supported by youroperating system ' s implementation of syslog. To use this option, youmust enable The--syslog option. --logpath <path>

Sends all diagnostic logging information to a log file instead of Tostandard for output or to the host ' Ssyslog system. MongoDB createsthe log file at the path of you specify.

By default, MongoDB overwrites the "log file" when the process restarts. To instead append to the log file, set the--logappend option. --logappend

Appends new entries to the "end of" the log file rather than overwritingthe content of the log when Themongod instance Resta Rts. --timestampformat <string>


The time format is timestamps in log messages. Specify one of thefollowing values:

Value Description
CTime Displays timestamps as Weddec 3118:17:54.811.
Iso8601-utc Displays timestamps in Coordinated Universal Time (UTC) in theISO-8601 format. For example to New York at the start of theepoch:1970-01-01t00:00:00.000z
Iso8601-local Displays timestamps in the Iso-8601format. For example to New York at the start of the epoch:1969-12-31t19:00:00.000+0500
--diaglog <value>


Deprecated since version 2.6.

The--diaglog is for internal with and not intended for most users.

Creates a very verbose diagnostic log for troubleshooting andrecording various. MongoDB writes these log files in Thedbpath directory in a series of the files that begin with TheString Diaglog and The initiation time of the logging as Ahex string.

The specified value configures the level of verbosity:

Value Setting
0 Off. No logging.
1 Log write operations.
2 LOG read operations.
3 Log both read and write operations.
7 Log write and some read operations.

Can use the Mongosniff tool to replay this output forinvestigation. Given A typical Diaglog file located at/data/db/diaglog.4f76a58c, you are might use a command at the Followingform to read the SE files:

  Mongosniff--source diaglog/data/db/diaglog.4f76a58c

Warning:: Setting The

   diagnostic level to ' 0 ' would cau Se:p rogram: ' Mongod ' to
   stop writing data to The:term: ' Diagnostic log ' file. However, the
   :p rogram: ' Mongod ' instance would continue to keep the file open,
   even if it is no longer writing data to the file. If you are want
   to rename, move, or delete the diagnostic log your must cleanly shut down the
   :p rogram: ' Mongod ' Instanc E before doing so.

For internal diagnostic. --pidfilepath <path>

Specifies a file location to hold the process ID of the mongodprocess. This is useful to tracking the Mongod process incombination with the--fork option. Without a specified--pidfilepath option, the process creates no PID file. --keyfile <file>

Specifies the path to a key file to that stores the shared secretthat MongoDB processes In asharded cluster or replica set.--keyfile implies--auth. Authentication Between MongoDB Instances for moreinformation. --setparameter <options>

Specifies one of the MongoDB parameters described Inmongodb Server parameters. You can specify Multiplesetparameterfields. --httpinterface

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.