核心配置项,即:systemLog
段下的配置
systemLog
- systemLog.verbosity = 0 日志级别、
- systemLog.quiet 安静模式运行,即:不输出任何日志【不推荐】
- systemLog.traceAllExceptions 打印所有异常信息,多用于调试
- systemLog.syslogFacility = user
- systemLog.path 日志文件路径
- systemLog.logAppend = False 追加日志
- systemLog.logRotate = rename 日志轮转
- systemLog.destination 日志输出 file | syslog
- systemLog.timeStampFormat = iso8601-local 时间格式
systemLog.component
- systemLog.component.accessControl.verbosity
- systemLog.component.command.verbosity
- systemLog.component.control.verbosity
- systemLog.component.ftdc.verbosity
- systemLog.component.geo.verbosity
- systemLog.component.index.verbosity
- systemLog.component.network.verbosity
- systemLog.component.query.verbosity
- systemLog.component.replication.verbosity
- systemLog.component.replication.heartbeats.verbosity
- systemLog.component.replication.rollback.verbosity
- systemLog.component.sharding.verbosity
- systemLog.component.storage.verbosity
- systemLog.component.storage.journal.verbosity
- systemLog.component.storage.recovery.verbosity
- systemLog.component.transaction.verbosity
- systemLog.component.write.verbosity
processManagement
- processManagement.fork = False
- processManagement.pidFilePath
- processManagement.timeZoneInfo
cloud
- cloud.monitoring.free.state
- cloud.monitoring.free.tags
net
- net.port -> 单机:27017 | 分片成员:27018 | 配置服务器:27019
- net.bindIp = localhost 多个地址,需要使用 [,]分隔
- net.bindIpAll = False
- net.maxIncomingConnections = 65536
- net.wireObjectCheck = True
- net.ipv6 = False
net.unixDomainSocket
- net.unixDomainSocket.enabled = True
- net.unixDomainSocket.pathPrefix = /tmp
- net.unixDomainSocket.filePermissions = 0700
net.ssl
- net.ssl.sslOnNormalPorts = disabled
- net.ssl.mode
- net.ssl.PEMKeyFile
- net.ssl.PEMKeyPassword
- net.ssl.certificateSelector
- net.ssl.clusterCertificateSelector
- net.ssl.clusterFile
- net.ssl.clusterPassword
- net.ssl.CAFile
- net.ssl.clusterCAFile
- net.ssl.CRLFile
- net.ssl.allowConnectionsWithoutCertificates
- net.ssl.allowInvalidCertificates
- net.ssl.allowInvalidHostnames = False
- net.ssl.disabledProtocols
- net.ssl.FIPSMode
net.compression
- net.compression.compressors = snappy
- net.serviceExecutor = synchronous
security
- security.keyFile
- security.clusterAuthMode = keyFile
- security.authorization = disabled
- security.transitionToAuth = False
- security.javascriptEnabled = True
- security.redactClientLogData
- security.sasl.hostName
- security.sasl.serviceName
- security.sasl.saslauthdSocketPath
- security.ldap.servers
- security.ldap.bind.queryUser
- security.ldap.bind.queryPassword
- security.ldap.bind.useOSDefaults = False
- security.ldap.bind.method = simple
- security.ldap.bind.saslMechanisms
storage
- storage.dbPath = /data/db | \data\db
- storage.indexBuildRetry = True
- storage.repairPath
- storage.journal.enabled = True
- storage.journal.commitIntervalMs = 100 or 30
- storage.directoryPerDB = False
- torage.syncPeriodSecs = 60
- storage.engine = wiredTiger
storage.wiredTiger
- storage.wiredTiger.engineConfig.cacheSizeGB = 50% of (RAM - 1 GB) or 256 MB
- storage.wiredTiger.engineConfig.journalCompressor = snappy
- storage.wiredTiger.engineConfig.directoryForIndexes = false
- storage.wiredTiger.collectionConfig.blockCompressor = snappy
- storage.wiredTiger.indexConfig.prefixCompression = true
storage.inmemory
- storage.inMemory.engineConfig.inMemorySizeGB = 50% of physical RAM less 1 GB
operationProfiling
- operationProfiling.mode = off
- operationProfiling.slowOpThresholdMs = 100
- operationProfiling.slowOpSampleRate
replication
- replication.oplogSizeMB
- replication.replSetName
- replication.enableMajorityReadConcern = True
sharding
- sharding.clusterRole
- sharding.archiveMovedChunks
mongos-only Options
- replication.localPingThresholdMs = 15
- sharding.configDB
以上配置都是在配置文件中的,可以通过命令行参数覆盖,对应参考官网:
https://docs.mongodb.com/manual/reference/configuration-file-settings-command-line-options-mapping/