mongodb 3.0 改变很多,从2.6版本升级到3.0要关注的细节很多,如权限等等。3.0在数据存储引擎上更换成了wiredTiger,在数据压缩方面很有效,解决大数据量问题的情况下,磁盘不够用的问题。
mongodb 3.0 配置文件采用的是YAML格式,只能使用空格,不支持tab键。文章源自运维生存时间-https://www.ttlsa.com/mongodb/mongodb-3-0-wiredtiger-engine-config-file/
单实例
systemLog: destination: file ###日志存储位置 path: /data/mongodb/log/mongod.log logAppend: true storage: ##journal配置 journal: enabled: true ##数据文件存储位置 dbPath: /data/zhou/mongo1/ ##是否一个库一个文件夹 directoryPerDB: true ##数据引擎 engine: wiredTiger ##WT引擎配置 wiredTiger: engineConfig: ##WT最大使用cache(根据服务器实际情况调节) cacheSizeGB: 10 ##是否将索引也按数据库名单独存储 directoryForIndexes: true ##表压缩配置 collectionConfig: blockCompressor: zlib ##索引配置 indexConfig: prefixCompression: true ##端口配置 net: port: 27017
复制集配置
在上述配置中加入下面的配置项文章源自运维生存时间-https://www.ttlsa.com/mongodb/mongodb-3-0-wiredtiger-engine-config-file/
replication: ##oplog大小 oplogSizeMB: 20480 ##复制集名称 replSetName: ttlsa
分片集群配置
分片复制集配置(单实例节点的基础上)文章源自运维生存时间-https://www.ttlsa.com/mongodb/mongodb-3-0-wiredtiger-engine-config-file/
replication: ##oplog大小 oplogSizeMB: 20 ##复制集名称 replSetName: ttlsa ##分片配置 sharding: ##分片角色 clusterRole: shardsvr
config server 配置(单实例节点的基础上)文章源自运维生存时间-https://www.ttlsa.com/mongodb/mongodb-3-0-wiredtiger-engine-config-file/
##分片配置 sharding: ##分片角色 clusterRole: configsvr
Mongos 配置(与单实例不同)文章源自运维生存时间-https://www.ttlsa.com/mongodb/mongodb-3-0-wiredtiger-engine-config-file/
##日志配置 systemLog: destination: file ##日志位置 path: /data/mongos/mongod.log logAppend: true ##网路配置 net: ##端口配置 port: 29020 ##分片配置 sharding: ##指定config server configDB: 10.96.29.2:29017,10.96.29.2:29018,10.96.29.2:29019文章源自运维生存时间-https://www.ttlsa.com/mongodb/mongodb-3-0-wiredtiger-engine-config-file/文章源自运维生存时间-https://www.ttlsa.com/mongodb/mongodb-3-0-wiredtiger-engine-config-file/

我的微信
微信公众号
扫一扫关注运维生存时间公众号,获取最新技术文章~
评论