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:
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.
The command line parameters passed to mongod can be viewed while the instance is running via the getCmdLineOpts command.
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 |
| --dbpath <path> |
Specifies the directory for datafiles. Default is /data/db or c:\data\db |
| --fork |
Fork the server process |
| --bind_ip <ip> |
Specifies a single IP that the database server will listen for |
| --directoryperdb |
Specify use of an alternative directory structure, in which files for each database are kept in a unique directory. (more details) (v1.4+) |
| --journalCommitInterval |
How often to group/batch commit (ms). Default 100ms |
| --nojournal |
Disable journaling. In v2.0+, journaling is on by default for 64-bit |
| --quiet |
Reduces amount of log output (more details) |
| --nohttpinterface |
Disable the HTTP interface (localhost:28017) |
| --rest |
Allow extended operations at the Http Interface |
| --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. |
| --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. This limits (by default) to 8 files per DB. This can be changed through the --quotaFiles parameter |
| --quotaFiles |
Maximum number of files that will be opened per Database. See --quota |
| --syncdelay arg (=60) |
seconds between disk syncs. Do not use zero. (more details) |
| --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 – limits results to single batch request. Do NOT use in production. This option will be removed in 2.1.0. |
| --nohints |
Ignore query hints |
| --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 |
| --smallfiles |
Use a smaller initial file size (16MB) and maximum size (512MB) |
| --nssize <MB> |
Specifies .ns file size for new databases |
| --sysinfo |
Print system info as detected by Mongo and exit |
| --nounixsocket |
disable listening on unix sockets (will not create socket files at /tmp/mongodb-<port>.sock) |
| --upgrade |
Upgrade database files to new format if necessary
(required when upgrading from <= v1.0 to v1.1+) |
Replica Set Options
| --replSet <setname>[/<seedlist>] |
Use replica sets with the specified logical set name. Typically the optional seed host list need not be specified. |
| --oplogSize <MB> |
Custom size for replication operation log |
Master/Slave Replication Options
Please use replica sets instead of master/slave.
| --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 |
| --arbiter <server:port> |
Address of arbiter server |
| --autoresync |
Automatically resync if slave data is stale |
| --oplogSize <MB> |
Custom size for replication operation log |
| --fastsync |
If the node has a completely up-to-date copy of the data, use this option to let it know it can skip the resync. Be careful – the server will assume it is caught up completely and if not so the data will be out of sync permanently. |
PLEASE POST QUESTIONS IN THE USER GROUPS FORUM. Post non-question comments and helpful hints here.
blog comments powered by Disqus