MongoDB 5.0.9 分片配置
https://www.mongodb.com/docs/v3.4/tutorial/deploy-sharded-cluster-ranged-sharding/
组件
mongos 负责router
config 负责配置(必须副本集)
mongod 负责存储(必须副本集)
Config 配置
processManagement:
fork: true
net:
bindIp: localhost
port: [**自定义端口**]
storage:
dbPath: /Volumes/SAO/data/mongo-sharding/db/c
systemLog:
destination: file
path: "/Volumes/SAO/data/mongo-sharding/logs/mongoc.log"
logAppend: true
storage:
journal:
enabled: true
replication:
oplogSizeMB: 1024
replSetName: rs2
sharding:
clusterRole: configsvr
mongod 配置
processManagement:
fork: true
net:
bindIp: localhost
port: [**自定义端口**]
storage:
dbPath: /Volumes/SAO/data/mongo-sharding/db/s1
systemLog:
destination: file
path: "/Volumes/SAO/data/mongo-sharding/logs/mongod1.log"
logAppend: true
storage:
journal:
enabled: true
sharding:
clusterRole: shardsvr
replication:
replSetName: sh1
operationProfiling:
mode: slowOp
slowOpThresholdMs: 500
mongos 配置
processManagement:
fork: true
net:
bindIp: localhost
port: 27018
systemLog:
destination: file
path: "/Volumes/SAO/data/mongo-sharding/logs/mongos.log"
logAppend: true
sharding:
configDB: rs2/127.0.0.1:27021,127.0.0.1:27022,127.0.0.1:27023
#步骤