MongoDB 3.0 changes a lot, upgrading from 2.6 to 3.0 has a lot of attention to detail, such as permissions and so on. 3.0 in the data storage engine to replace the Wiredtiger, in the data compression is very effective, to solve the problem of large data volume, the disk is not enough.
The MongoDB 3.0 configuration file is in YAML format and can only use spaces and does not support the TAB key.
Single Instance
12345678910111213141516171819202122232425262728293031 |
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 (adjust according to the actual server) cachesizegb: ten # #是否将索引也按数据库名单独存储 directoryforindexes: true # #表压缩配置 collectionconfig: blockcompressor: zlib # #索引配置 indexconfig: prefixcompression: true # #端口配置net: Port: 27017 |
Replica Set Configuration
Add the following configuration entry in the above configuration
12345 |
replication: # #oplog大小 oplogsizemb: 20480 # #复制集名称 replsetname: ttlsa |
Shard Cluster Configuration
Shard Replica Set configuration (on a single-instance node basis)
12345678 9 |
replication: # #oplog大小 oplogsizemb : 20 # #复制集名称 replsetname: ttlsa # #分片配置 sharding: # #分片角色 clusterrole: shardsvr |
Config server configuration (on a single-instance node basis)
1234 |
# #分片配置 sharding: # #分片角色 clusterrole: configsvr |
Mongos configuration (different from single instance)
1234567891011121314 |
# #日志配置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 |
Go MongoDB 3.0 WT Engine reference configuration file