|
The configuration file is in the /etc/mongod.conf file How to start ./bin/mongod -f MongoDB.conf will see about to fork child process, waiting until server is 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 #端口号 The default is 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 #这个选项可以过滤掉一些无用的日志信息, if you need to debug it, set it to false quiet=true Other configuration parameter meanings
| --quiet | # Quiet output | | --port arg | # Specify the service port number, the default port is 27017 | | --bind_ip arg | # Bind service IP, if you bind 127.0.0.1, you can only access it locally, and do not specify all local IPs by default | | --logpath arg | # Specify the MongoDB log file, noting that the file is not a directory | | --logappend | # Write a log using an appendix | | --pidfilepath arg | # Full path to PID file, if not set, there is no PID file | | --keyFile arg | # The full path of the cluster's private key is only valid for the Replica Set architecture | | --unixSocketPrefix arg | # UNIX domain socket alternative directory, (default is /tmp) | | --fork | # Run MongoDB as a daemon and create a server process | | --auth | # Enable authentication | | --cpu | # Periodically displays CPU utilization and iowait of the CPU | | --dbpath arg | # Specify the database path | | --diaglog arg | # diaglog option 0=off 1=W 2=R 3=both 7=W+some reads | | --directoryperdb | # Set that each database will be saved in a separate directory | | --journal | # Enable the log option, and MongoDB data operations will be written to the file in the journal folder | | --journalOptions arg | # Enable log diagnostics option | | --ipv6 | # Enable IPv6 option | | --jsonp | # Allow JSONP access via HTTP (with security implications) | | --maxConns arg | # Maximum number of simultaneous connections Default 2000 | | --noauth | # Validation is not enabled | | --nohttpinterface | # Turn off the HTTP interface, and disable port 27018 access by default | | --noprealloc | # Disable data file pre-allocation (often affects performance) | | --noscrip{filter}ting | # Disable scripting engines | | --notablescan | # Table scanning is not allowed | | --nounixsocket | # Disable Unix socket listening | | --nssize arg (=16) | # Set the Letter Database.ns File Size (MB) | | --objcheck | # upon receipt of customer data, check validity, | | --profile arg | # File parameter 0=off 1=slow, 2=all | | --quota | # Limit the number of files per database, and set the default to 8 | | --quotaFiles arg | # number of files allower per db, requires --quota | | --rest | # Open a simple rest API | | --repair | # Run repair on all dbs | | --repairpath arg | # Fix the directory of the file generated by the library, which defaults to the directory name dbpath | | --slowms arg (=100) | # value of slow for profile and console log | | --smallfiles | # Use smaller default files | | --syncdelay arg (=60) | # The number of seconds of data written to disk (0=never, not recommended) | | --sysinfo | # Print some diagnostic system information | | --upgrade | # If you need to upgrade the database |
* Replicaton parameter
--------------------------------------------------------------------------------
| --fastsync | # Enable slave replication from a database in a dbpath that is a snapshot of the main database and can be used to quickly enable synchronization | | --autoresync | # If the synchronization data from the slave library is much worse than the main database, automatically re-synchronize, | | --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 replication | | --slavedelay arg | # Set the delay time to sync the primary library from the library |
* Replica set option:
--------------------------------------------------------------------------------
| --replSet arg | # Set the replica set name |
* Sharding option
--------------------------------------------------------------------------------
| --configsvr | # Declare that this is the config service of the cluster, default port 27019, default directory /data/configdb | | --shardsvr | # Declare that this is a shard of the cluster, default port 27018 | | --noMoveParanoia | # Turn off paranoia for moveChunk data preservation |
Official configuration introduction:
https://docs.mongodb.com/manual/reference/configuration-options/
https://docs.mongodb.com/v2.4/reference/configuration-options/
|