设为首页 加入收藏

TOP

mongod.conf(一)
2015-11-21 01:35:01 来源: 作者: 【 】 浏览:2
Tags:mongod.conf
mongod -f 'config path'

MongoDB引入一个YAML-based格式的配置文件。2.4版本以前的仍然兼容。

我的mongodb配置文件:
systemLog: 
  destination: file
  path: "/var/log/mongo/mongod.log"
  quiet: true
  logAppend: true
  timeStampFormat: iso8601-utc
storage: 
  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
    commitIntervalMs: 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: "disabled"
replication:
  oplogSizeMB: 50
  replSetName: "repl_test"
  secondaryIndexPrefetch: "all"

设置选项:
1. systemLog
systemLog.verbosity 
integer
日志文件输出的级别,越大级别越低。
systemLog.quite
boolean
在quite模式下会限制输出信息:
数据库命令输出,副本集活动,连接接受事件,连接关闭事件。
systemLog.traceAllExceptions 
string
打印verbose信息来调试,用来记录证额外的异常日志。
systemLog.syslogFacility
string,默认为user
指定syslog日志信息的设备级别。需要指定--syslog来使用这个选项。
systemLog.path string
发送所有的诊断信息日志,默认重启后会覆盖。
systemLog.logAppend
boolean
是否启用追加日志。
systemLog.destination
string
指定一个文件或syslog。如果指定为文件,必须同时指定systemLog.path
systemLog.timeStampFormat
string,默认为iso8601-local
日志信息中的时间戳格式:
ctime,iso8601-utc,iso8601-local

2. processManagement
processManagement.pidFilePath
string
指定进程的ID,与--fork配合使用,不指定则不会创建。
processManagement.fork
boolean,默认为false
是守护进程在后台运行。

3. net
net.port
interger,默认为27017
mongodb实例监听的端口号。
net.bindIp
string,2.6版本默认为127.0.0.1
指定mongodb实例绑定的ip,为了绑定多个ip,可以使用逗号分隔。
net.maxIncomingConnections
integer 默认为1000000
mongodb实例接受的最多连接数,如果高于操作系统接受的最大线程数,设置无效。
net.wireObjectCheck
boolean,默认为true
检查文档的有效性。会稍微影响性能。
net.http.enabled
boolean,默认为false
打开http端口,会导致更多的不安全因素。
net.unixDomainSocket.enabled
boolean,默认为false
停止UNIX domain socket监听。
mongodb实例会一直监听UNIX
socket,除非net.unixDomainSocket.enabled设置为true,bindIp没有设置,bindIp没有默认指定为127.0.0.1。
net.unixDomainSocket.pathPrefix
string,默认为/tmp
unix Socket所在的路径。
net.ipv6
boolean,默认为false
打开IPV6功能,默认为关闭的。
net.http.JSONPEnabled
boolean,默认为false
运行json访问http端口,打开会导致更多的不安全因素。
net.http.RESTInterfaceEnabled
boolean,默认为false
即使http接口选项关闭,打开也会暴露http接口,会导致更多的不安全因素。

4. security
security.keyFile
string
指定分片集或副本集成员之间身份验证的key文件存储位置。
security.clusterAuthMode
string
集群认证中利用到这个模式,如果使用x.509安全机制,可以在这里指定。
keyFile,sendKeyFile,sendX509,x509
默认的mongodb发行版是不支持ssl的,可以使用专业版的或重新自行编译mongodb。
security.authorization
string,默认为disabled
打开访问数据库和进行操作的用户角色认证。
enabled,disabled

5. operationProfiling
operationProfiling.slowOpThresholdMs
integer,默认100
指定慢查询时间,单位毫秒,如果打开功能,则向system.profile集合写入数据。
operationProfiling.mode
integer,默认0
改变分析日志输出级别。
0,1,2,分别对应关闭,仅打开慢查询,记录所有操作。

6. storage
storage.dbPath
string
指定数据文件的路径。
storage.directoryPerDB
boolean,默认关闭
指定存储每个数据库文件到单独的数据目录。如果在一个已存在的系统使用该选项,需要事先把存在的数据文件移动到目录。
storage.indexBuildRetry
boolean,默认为t
首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇session入库 下一篇关于Windows数据库服务器更换为Li..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: