Mongod. conf
Mongod-f 'config path' MongoDB introduces a configuration file in YAML-based format. Versions earlier than 2.4 are still compatible. My mongodb configuration file: systemLog: destination: file path: "/var/log/mongo/mongod. log "quiet: true logAppend: true timeStampFormat: iso8601-utcstorage: dbPath:"/var/lib/mongo "directoryPerDB: true indexBuildRetry: false preallocDataFiles: true nsSize: 16 # quota: # enforced: false # maxFilesPerDB: 8 smallFiles: false syncPeriodSecs: 60 # repairPath: "/var/lib/mongo/_ tmp" journal: enabled: true # debugFlags: 1 co MmitIntervalMs: 100 processManagement: fork: true pidFilePath: "/var/run/mongodb/mongod. pid "net: # bindIp: 192.168.11.52 port: 27017 http: enabled: true RESTInterfaceEnabled: false # ssl: # mode:" requireSSL "# PEMKeyFile:"/etc/ssl/mongodb. pem "operationProfiling: slowOpThresholdMs: 100 mode:" slowOp "security: keyFile:"/var/lib/mongo/mongodb-keyfile "clusterAuthMode:" keyFile "authorization:" disabl Ed "replication: oplogSizeMB: 50 replSetName:" repl_test "secondaryIndexPrefetch:" all "setting options: 1. systemLogsystemLog. verbosity integer log file output level. The larger the level, the lower the level. SystemLog. quiteboolean limits the output information in quite mode: Database Command output, replica set activity, connection acceptance event, and connection close event. SystemLog. traceAllExceptions string prints verbose information for debugging, used to record additional exception logs. SystemLog. syslogFacilitystring, which specifies the device level of syslog information by default. You must specify -- syslog to use this option. SystemLog. path string sends all diagnostic information logs, which will be overwritten after restart by default. SystemLog. logAppendboolean whether to enable append log. SystemLog. destinationstring specifies a file or syslog. If it is specified as a file, systemLog must be specified at the same time. pathsystemLog. timeStampFormatstring, default is the timestamp format in the iso8601-local log information: ctime, iso8601-utc, iso8601-local2. processManagementprocessManagement. pidFilePathstring specifies the process ID, which is used with -- fork. If it is not specified, it is not created. ProcessManagement. forkboolean. The default value "false" indicates that the daemon runs in the background. 3. netnet. portinterger. The default port number is the port number listened to by the 27017mongodb instance. Net. bindIpstring, Which is 127.0.0.1 by default. It specifies the ip address bound to the mongodb instance. To bind multiple ip addresses, use commas to separate them. By default, net. maxIncomingConnectionsinteger is the maximum number of connections accepted by the MongoDB instance. If it is higher than the maximum number of threads accepted by the operating system, the setting is invalid. Net. wireObjectCheckboolean. The default value is true to check the validity of the document. Performance is slightly affected. Net. http. enabledboolean. The default value is false. Enabling the http port will lead to more insecure factors. Net. unixDomainSocket. enabledboolean. The default value is false. Mongodb instances always listen to UNIXsocket, unless net. unixDomainSocket. enabled is set to true, bindIp is not set, and bindIp is not set to 127.0.0.1 by default. Net. unixDomainSocket. pathPrefixstring. The default path is/tmpunix Socket. Net. ipv6boolean. The default value is false. The IPV6 function is enabled. The default value is disabled. Net. http. JSONPEnabledboolean. The default value is false. When json is run to access the http port, more insecure factors are caused. Net. http. RESTInterfaceEnabledboolean. The default value is false. Even if the http interface option is disabled, opening the http interface exposes more insecure factors. 4. securitysecurity. keyFilestring specifies the key file storage location for authentication between the shard set or replica set members. This mode is used in security. clusterAuthModestring cluster authentication. If you use the x.509 security mechanism, you can specify it here. KeyFile, sendKeyFile, sendX509, and x509 default mongodb releases do not support ssl. You can use the Professional edition or re-compile mongodb. Security. authorizationstring. The default value is disabled, which enables user role authentication for database access and operations. Enabled, disabled5. operationProfilingoperationProfiling. slowOpThresholdMsinteger. By default, 100 specifies the slow query time, in milliseconds. If the function is enabled, data is written to the system. profile set. OperationProfiling. modeinteger, which defaults to 0 to change the log output level. 0, 1, 2, respectively, corresponding to closed, only open slow query, record all operations. 6. storagestorage. dbPathstring specifies the path of the data file. Storage. directoryPerDBboolean. By default, it is disabled to specify to store each database file to a separate data directory. If you use this option in an existing system, you must first move the existing data file to the directory. Storage. indexBuildRetryboolean. The default value is true, indicating whether to re-create an index after the database is stopped during index creation. Storage. preallocDataFilesboolean. By default, true indicates whether data files are pre-sliced. Storage. nsSizeinteger. By default, 16 specifies the namespace size, that is, the file with the. ns suffix. The maximum size is 2047 MB. A 16 M file can provide about 24000 namespaces. Storage. quota. enforcedboolean, which defaults to false to limit the number of data files in each database. You can adjust the number through maxFilesPerDB. Storage. quota. maxFilesPerDBinteger. The default value is 8, which limits the number of data files in each database. Storage. smallFilesboolean. The default value is false, which limits the size of mongodb data files to 512 MB and reduces the size of journal files from 1 GB to 128 MB. This is suitable for data files with many small numbers. Storage. syncPeriodSecsnumber, which defaults to the refreshing frequency of 60 MongoDB files. do not modify the number in the production environment. Storage. repairPathstring, which is the _ tmp directory under the specified dbpath by default. Specify the root directory of the data file and perform the -- repair operation. Storage. journal. enabledboolean. By default, 64bit is true, and 32bit is false, which records operation logs to prevent data loss. Storage. journal. debugFlagsinteger provides function testing for abnormal database shutdown. Storage. journal. commitIntervalMsnumber. The default value is 100 or 30journal. It can be a value between 2-Ms. A low value is helpful for persistence, but it will increase the extra burden on the disk. If the journal and data files are on the same disk, the default value is 100 ms. If it is 30 ms on different disks. If you force mongod to submit a log file, you can specify j: true. After this parameter is specified, the time is changed to the original 1/3. 7. replicationreplication. oplogSizeMBinteger. By default, the maximum oplog size is specified for disk 5%. The specified oplog. rs parameter is invalid. Replication. replSetNamestring specifies the replica set name. Replication. secondaryIndexPrefetchstring. The default value is all, which specifies whether the replica integrator loads the index to the memory before accepting the oplog. By default, all indexes are loaded to the memory. None, do not load; all, load all; _ id_only, only load _ id. 8. shardingsharding. clusterRolestring specifies the mongodb role of the shard set. Configsvr: Configure the server, port 27019, shardsvr, sharded instance, and port 27018. Sharding. archiveMovedChunksinteger during block movement, this option forces the mongodb instance to save all the moved documents to the moveChunk directory. 9. auditLogauditLog. destinationstringsyslog, Which is saved in json format and verified to syslog. It is unavailable in windows. The serverity level is info and the facility level is user. Console, which outputs information to the standard output in json format. File, which outputs information to the file in json format. AuditLog. formatstring specifies the JSON format of the output file, and the json format of the output file; BSON: outputs the bson binary format file. AuditLog. pathstring if the value of -- auditDestination is file, this option specifies the file path. AuditLog. filterdocument specifies the format for filtering system authentication: {atype: <expression >}{ atype: <expression>, "param. db ": <database >}10. snmpsnmp. subagentboolean runs SNMP as a sub-proxy. Snmp. masterboolean runs SNMP as a main process. Only the replication. localPingThresholdMsinteger option of mongos is supported. The default value is 15, which is affected when the client selects the replica set for read operations. Sharding. autoSplitboolean prevents mongos from automatically inserting metadata in a shard set. Any mongos can create a separation. If you enable this option, the shards will be unbalanced and you need to use it with caution. Sharding. configDBstring specifies the configuration database. You can use commas to separate one or three servers. If you are in a different location, you must specify the nearest one. The configuration server cannot be removed, even if it is unavailable or offline. Sharding. chunkSizeinteger. The default value is 64. 64 MB is the ideal size. If it is small, it cannot be moved between different nodes efficiently. Valid only during initialization. The Windows Service option processManagement. windowsService. serviceNamestring specifies the MongoDB service name by default. You can use -- install and -- remove to add or delete a file. ProcessManagement. windowsService. displayNamestring. By default, the name of the MongoDB service application is set for mongodb. ProcessManagement. windowsService. descriptionstring. The default value is MongoDB Server combined with -- install. The value of this option must be specified. ProcessManagement. windowsService. serviceUser specifies the password of the user whose mongodb service runs processManagement. windowsService. servicePassword.