# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/# where to write logging data.
systemLog: #系统日志
destination: file #日志输出目的地
logAppend: true # 如果为true,当mongod/mongos重启后,将在现有日志的尾部继续添加日志。否则,将会备份当前日志文件,然后创建一个新的日志文件;默认为false。
path: /var/log/mongodb/mongod.log #日志路径# Where and how to store data.
storage:
dbPath: /var/lib/mongo # mongod进程存储数据目录,此配置仅对mongod进程有效
journal:
enabled: true #是否开启journal日志持久存储,journal日志用来数据恢复,是mongod最基础的特性,通常用于故障恢复。64位系统默认为true,32位默认为false,建议开启,仅对mongod进程有效。
# engine: #存储引擎类型,mongodb 3.0之后支持“mmapv1”、“wiredTiger”两种引擎,默认值为“mmapv1”;官方宣称wiredTiger引擎更加优秀。
# wiredTiger: #对wiredTiger引擎配置生效# how the process runs
processManagement:
fork: true # fork and run in background 运行在后台
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile PID文件路径
timeZoneInfo: /usr/share/zoneinfo# network interfaces
net:
port: 27017 #端口
bindIp: 127.0.0.1
# Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting. 绑定外网op 多个用逗号分隔,如果开放全部外网访问, 输入0.0.0.0
# maxIncomingConnections: 65536 #进程允许的最大连接数 默认值为65536
# wireObjectCheck: true #当客户端写入数据时 检测数据的有效性(BSON) 默认值为true
#security: #安全有关的配置
#authorization: enabled #disabled或者enabled,仅对mongod有效;表示是否开启用户访问控制(Access Control),即客户端可以通过用户名和密码认证的方式访问系统的数据,默认为“disabled”,即客户端不需要密码即可访问数据库数据。(限定客户端与mongod、mongos的认证)
#javascriptEnabled: true #true或者false,默认为true,仅对mongod有效;表示是否关闭server端的javascript功能,就是是否允许mongod上执行javascript脚本,如果为false,那么mapreduce、group命令等将无法使用,因为它们需要在mongod上执行javascript脚本方法。如果你的应用中没有mapreduce等操作的需求,为了安全起见,可以关闭javascript。
#operationProfiling: #性能分析器
#slowOpThresholdMs: 100 #数据库profiler判定一个操作是“慢查询”的时间阀值,单位毫秒;
#mode: off #数据库profiler级别,操作的性能信息将会被写入日志文件中,
# 可选值:1)off:关闭profiling
# 2)slowOp:on,只包含慢操作日志
# 3)all:on,记录所有操作
# 数据库profiling会影响性能,建议只在性能调试阶段开启。此参数仅对mongod有效。
#replication: #主从复制 主备模式 这个是大点,需要单独讲
#oplogSizeMB:10240 #replication操作日志的最大尺寸,单位:MB。#sharding: #sharding架构 集群中使用,暂时没有接触