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 127.0.0.1, 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 |
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
# 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
specifically use the following:
[Sdh@localhost bin]$./mongod --config/home/sdh/mongodb/mongo.conf