Mongodb 核心配置项说明

核心配置项,即:systemLog 段下的配置

systemLog

  1. systemLog.verbosity = 0 日志级别、
  2. systemLog.quiet 安静模式运行,即:不输出任何日志【不推荐】
  3. systemLog.traceAllExceptions 打印所有异常信息,多用于调试
  4. systemLog.syslogFacility = user
  5. systemLog.path 日志文件路径
  6. systemLog.logAppend = False 追加日志
  7. systemLog.logRotate = rename 日志轮转
  8. systemLog.destination 日志输出 file | syslog
  9. systemLog.timeStampFormat = iso8601-local 时间格式

systemLog.component

  1. systemLog.component.accessControl.verbosity
  2. systemLog.component.command.verbosity
  3. systemLog.component.control.verbosity
  4. systemLog.component.ftdc.verbosity
  5. systemLog.component.geo.verbosity
  6. systemLog.component.index.verbosity
  7. systemLog.component.network.verbosity
  8. systemLog.component.query.verbosity
  9. systemLog.component.replication.verbosity
  10. systemLog.component.replication.heartbeats.verbosity
  11. systemLog.component.replication.rollback.verbosity
  12. systemLog.component.sharding.verbosity
  13. systemLog.component.storage.verbosity
  14. systemLog.component.storage.journal.verbosity
  15. systemLog.component.storage.recovery.verbosity
  16. systemLog.component.transaction.verbosity
  17. systemLog.component.write.verbosity

processManagement

  1. processManagement.fork = False
  2. processManagement.pidFilePath
  3. processManagement.timeZoneInfo

cloud

  1. cloud.monitoring.free.state
  2. cloud.monitoring.free.tags

net

  1. net.port -> 单机:27017 | 分片成员:27018 | 配置服务器:27019
  2. net.bindIp = localhost 多个地址,需要使用 [,]分隔
  3. net.bindIpAll = False
  4. net.maxIncomingConnections = 65536
  5. net.wireObjectCheck = True
  6. net.ipv6 = False

net.unixDomainSocket

  1. net.unixDomainSocket.enabled = True
  2. net.unixDomainSocket.pathPrefix = /tmp
  3. net.unixDomainSocket.filePermissions = 0700

net.ssl

  1. net.ssl.sslOnNormalPorts = disabled
  2. net.ssl.mode
  3. net.ssl.PEMKeyFile
  4. net.ssl.PEMKeyPassword
  5. net.ssl.certificateSelector
  6. net.ssl.clusterCertificateSelector
  7. net.ssl.clusterFile
  8. net.ssl.clusterPassword
  9. net.ssl.CAFile
  10. net.ssl.clusterCAFile
  11. net.ssl.CRLFile
  12. net.ssl.allowConnectionsWithoutCertificates
  13. net.ssl.allowInvalidCertificates
  14. net.ssl.allowInvalidHostnames = False
  15. net.ssl.disabledProtocols
  16. net.ssl.FIPSMode

net.compression

  1. net.compression.compressors = snappy
  2. net.serviceExecutor = synchronous

security

  1. security.keyFile
  2. security.clusterAuthMode = keyFile
  3. security.authorization = disabled
  4. security.transitionToAuth = False
  5. security.javascriptEnabled = True
  6. security.redactClientLogData
  7. security.sasl.hostName
  8. security.sasl.serviceName
  9. security.sasl.saslauthdSocketPath
  10. security.ldap.servers
  11. security.ldap.bind.queryUser
  12. security.ldap.bind.queryPassword
  13. security.ldap.bind.useOSDefaults = False
  14. security.ldap.bind.method = simple
  15. security.ldap.bind.saslMechanisms

storage

  1. storage.dbPath = /data/db | \data\db
  2. storage.indexBuildRetry = True
  3. storage.repairPath
  4. storage.journal.enabled = True
  5. storage.journal.commitIntervalMs = 100 or 30
  6. storage.directoryPerDB = False
  7. torage.syncPeriodSecs = 60
  8. storage.engine = wiredTiger

storage.wiredTiger

  1. storage.wiredTiger.engineConfig.cacheSizeGB = 50% of (RAM - 1 GB) or 256 MB
  2. storage.wiredTiger.engineConfig.journalCompressor = snappy
  3. storage.wiredTiger.engineConfig.directoryForIndexes = false
  4. storage.wiredTiger.collectionConfig.blockCompressor = snappy
  5. storage.wiredTiger.indexConfig.prefixCompression = true

storage.inmemory

  1. storage.inMemory.engineConfig.inMemorySizeGB = 50% of physical RAM less 1 GB

operationProfiling

  1. operationProfiling.mode = off
  2. operationProfiling.slowOpThresholdMs = 100
  3. operationProfiling.slowOpSampleRate

replication

  1. replication.oplogSizeMB
  2. replication.replSetName
  3. replication.enableMajorityReadConcern = True

sharding

  1. sharding.clusterRole
  2. sharding.archiveMovedChunks

mongos-only Options

  1. replication.localPingThresholdMs = 15
  2. sharding.configDB

以上配置都是在配置文件中的,可以通过命令行参数覆盖,对应参考官网:

https://docs.mongodb.com/manual/reference/configuration-file-settings-command-line-options-mapping/