Command Line Parameters

MongoDB can be configured via command line parameters in addition to File Based Configuration. You can see the currently supported set of command line options by running the database with -h [ --help ] as a single parameter:

$ ./mongod -h

Information on usage of these parameters can be found in Starting and Stopping Mongo.

The following list of options is not complete; for the complete list see the usage information as described above.

Basic Options

-h | --help Shows all options
-f | --config <file> Specify a configuration file to use
--port <portno> Specifies the port number on which Mongo will listen for client connections. Default is 27017
--bind_ip <ip> Specifies a single IP that the database server will listen for
--dbpath <path> Specifies the directory for datafiles. Default is /data/db or c:\data\db
--directoryperdb Specify use of an alternative directory structure, in which files for each database are kept in a unique directory. (since 1.3.2)
--quiet Reduces amount of log output
--logpath <file> File to write logs to (instead of stdout). You can rotate the logs by sending SIGUSR1 to the server.
--logappend Append to existing log file, instead of overwritting
--repairpath <path> Root path for temporary files created during database repair. Default is dbpath value.
--fork Fork the server process
--cpu Enables periodic logging of CPU utilization and I/O wait
--noauth Turns off security. This is currently the default
--auth Turn on security
-v[v[v[v[v]]]] | --verbose Verbose logging output (-vvvvv is most verbose, -v == --verbose)
--objcheck Inspect all client data for validity on receipt (useful for developing drivers)
--quota Enable db quota management
--diaglog <n> Set oplogging level where n is 0=off (default) 1=W 2=R 3=both 7=W+some reads
--nocursors Diagnostic/debugging option
--nohints Ignore query hints
--nohttpinterface Disable the HTTP interface (localhost:27018)
--noscripting Turns off server-side scripting. This will result in greatly limited functionality
--notablescan Turns off table scans. Any query that would do a table scan fails
--noprealloc Disable data file preallocation
--nssize <MB> Specifies .ns file size for new databases
--sysinfo Print system info as detected by Mongo and exit
--upgrade Upgrade database files to new format if necessary
(required when upgrading from <= 1.0 to 1.1+)

Replication Options

--master Designate this server as a master in a master-slave setup
--slave Designate this server as a slave in a master-slave setup
--source <server:port> Specify the source (master) for a slave instance
--only <db> Slave only: specify a single database to replicate
--pairwith <server:port> Address of a server to pair with
--arbiter <server:port> Address of arbiter server
--autoresync Automatically resync if slave data is stale
--oplogSize <MB> Custom size for replication operation log
--opIdMem <bytes> Size limit for in-memory storage of op ids

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

IF YOU HAVE A QUESTION, POST IT TO THE USER GROUP.

These pages are fine for comments, but for questions, your best bet will always be the MongoDB User Group.

blog comments powered by Disqus