Starting mode
./bin/mongod-f mongodb.conf
'll see
About-to-fork child process, waiting until server was ready for connections.
Forked process:2313
Child process started successfully, parent exiting
Basic Configuration
#数据库数据存放目录
Dbpath=/usr/local/mongodb304/data
#数据库日志存放目录
Logpath=/usr/local/mongodb304/logs/mongodb.log
#以追加的方式记录日志
Logappend = True
#端口号 defaults to 27017
port=27017
#以后台方式运行进程
Fork=true
#开启用户认证
Auth=true
#关闭http接口, HTTP port access is turned off by default
Nohttpinterface=true
#mongodb所绑定的ip地址
BIND_IP = 127.0.0.1
#启用日志文件, enabled by default
Journal=true
#这个选项可以过滤掉一些无用的日志信息, set to False if you need to use Debug
Quiet=true
Other configuration parameter Meanings
--quiet |
# quiet Output |
--port Arg |
# Specify the service port number, default ports 27017 |
--BIND_IP Arg |
# Bind service IP, if bind 127.0.0.1, can only native access, do not specify default local all IP |
--logpath Arg |
# Specify the MongoDB log file, note that the specified file is not a directory |
--logappend |
# Write a log using append |
--pidfilepath Arg |
# The full path of the PID file, if not set, there are no PID files |
--keyfile Arg |
# The full path of the cluster's private key, valid only for the replica Set schema |
--unixsocketprefix Arg |
# UNIX domain Socket Alternative directory, (default =/tmp) |
--fork |
# run MongoDB as a daemon and create a server process |
--auth |
# Enable Validation |
--cpu |
# Periodic display of CPU utilization and iowait |
--dbpath Arg |
# Specify Database path |
--diaglog Arg |
# Diaglog Options 0=off 1=w 2=r 3=both 7=w+some reads |
--directoryperdb |
# Set each database to be saved in a separate directory |
--journal |
# Enable logging option, MONGODB data operation will be written to the file in the Journal folder |
--journaloptions Arg |
# Enable Log Diagnostics options |
--ipv6 |
# Enable IPV6 option |
--jsonp |
# Allow JSONP form to be accessed via HTTP (with security implications) |
--maxconns Arg |
# Maximum number of simultaneous connections default 2000 |
--noauth |
# Do not enable validation |
--nohttpinterface |
# Close the HTTP interface and turn off 27018 port access by default |
--noprealloc |
# Disable data file pre-allocation (often impacting performance) |
--noscripting |
# Disable scripting engine |
--notablescan |
# No table scan allowed |
--nounixsocket |
# Disable UNIX socket snooping |
--nssize Arg (=16) |
# Set the message database. ns File Size (MB) |
--objcheck |
# in the receipt of customer data, check the validity of |
--profile Arg |
# file Parameters 0=off 1=slow, 2=all |
--quota |
# limit the number of files per database, set default to 8 |
--quotafiles Arg |
# Number of files Allower per db, requires--quota |
--rest |
# Open a simple rest API |
--repair |
# fix all databases run repair on all DBS |
--repairpath Arg |
# Fix the directory of the files generated by the library, default to 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 data written 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 enabled from the Library Replication service, the DBPath database is a snapshot of the main library and can be used to quickly enable synchronization |
--autoresync |
# If synchronizing data from the library to the main library is much worse, automatic resynchronization |
--oplogsize Arg |
# Set the size of the Oplog (MB) |
* Master/slave parameters
--------------------------------------------------------------------------------
--master |
# Main Library Mode |
--slave |
# from Library mode |
--source Arg |
# from the Library port number |
--only Arg |
# Specify a single database copy |
--slavedelay Arg |
# Set the delay time for synchronizing the main library from the library |
* Replica set (replica set) option:
--------------------------------------------------------------------------------
--replset Arg |
# set Replica set name |
* sharding (Shard) option
--------------------------------------------------------------------------------
--configsvr |
# Declare this is a clustered config service, default port 27019, default directory/data/configdb |
--shardsvr |
# Declare this is a clustered shard, default port 27018 |
--nomoveparanoia |
# Turn off paranoid for movechunk data save |
MongoDB configuration file Commentary (reproduced)