Mongodb startup command parameter description in Chinese

  • 2020-05-14 05:17:54
  • OfStack

We can view all the parameter descriptions of mongod through mongod --help. The following is the Chinese explanation of each parameter.

The basic configuration


� quiet
# Quiet output � port arg
# Specify the service port number, the default port 27017 � bind_ip arg
# Binding service IP If the binding 127.0.0.1 , can only be accessed natively without specifying the default local ownership IP � logpath arg
# The specified MongoDB Log file. Note that the specified file is not a directory � logappend
# Log using append � pidfilepath arg
# PID File The full path, if not set, then not PID file � keyFile arg
# The full path of the private key of the cluster, only for Replica Set Architecture effectively � unixSocketPrefix arg
# UNIX The domain socket replaces the directory ,( The default is /tmp) � fork
# Run as a daemon MongoDB , create the server process � auth
# Enables validation � cpu
# Display on a regular basis CPU the CPU Utilization and iowait � dbpath arg
# Specify the database path � diaglog arg
# diaglog options 0=off 1=W 2=R 3=both 7=W+some reads � directoryperdb
# Setup each database will be saved in 1 Two separate directories � journal
# Enable the logging option, MongoDB The data operation will be written to journal File in the folder � journalOptions arg
# Enable the log diagnostics option � ipv6
# To enable the IPv6 options � jsonp
# allow JSONP Form by HTTP Access (with security implications) � maxConns arg
# Maximum number of simultaneous connections The default 2000 � noauth
# Do not enable validation � nohttpinterface
# Shut down http Interface, closed by default 27018 Port access � noprealloc
# Disable data file preallocation ( Tends to affect performance ) � noscripting
# Disable script engine � notablescan
# Table scans are not allowed � nounixsocket
# disable Unix Socket listening � nssize arg (=16)
# Set up the letter database .ns The file size (MB) � objcheck
# Receiving customer data , Check for effectiveness, � profile arg
# Profile parameters 0=off 1=slow, 2=all � quota
# Limit the number of files per database by default 8 � quotaFiles arg
# number of files allower per db, requires � quota � rest
# Open simple rest API � repair
# Fix all databases run repair on all dbs � repairpath arg
# Fix the directory of files generated by the library , The default is the directory name dbpath � slowms arg (=100)
# value of slow for profile and console log � smallfiles
# Use a smaller default file � syncdelay arg (=60)
# The number of seconds it takes for data to be written to disk (0=never, Is not recommended ) � sysinfo
# print 1 Some diagnostic system information � upgrade
# If you need to upgrade your database

Replicaton parameters

� fastsync
# from 1 a dbpath Enable the slave library replication service in the dbpath Is a snapshot of the master library and can be used to quickly enable synchronization � autoresync
# If the slave database synchronizes with the master database much worse, automatically resynchronizes, � oplogSize arg
# Set up the oplog The size of the (MB)

Master/slave parameters


� master
# The main library � slave
# From library mode � source arg
# From the library The port number � only arg
# Specify a single 1 Database replication of � slavedelay arg
# Sets the delay time for the slave library to synchronize the master library

Replica set(replica set) option


 � replSet arg
# Set the replica set name

Sharding(sharding) option

� configsvr
# Statement that is 1 A cluster of config service , The default port 27019 , default directory /data/configdb � shardsvr
# Statement that is 1 The sharding of a cluster , The default port 27018 � noMoveParanoia
# Close paranoia for moveChunk Save the data ?

Example:


./mongod -shardsvr -replSet shard1 -port 16161 -dbpath /data/mongodb/data/shard1a -oplogSize 100 -logpath /data/mongodb/logs/shard1a.log -logappend -fork -rest

The above parameters can be written into the mongod.conf configuration document, for example:


dbpath = /data/mongodb
logpath = /data/mongodb/mongodb.log
logappend = true
port = 27017
fork = true
auth = true


Related articles: