Deploy Sharded Cluster using Ranged Sharding — MongoDB Manual
组件
mongos 负责router
config 负责配置(必须副本集)
mongod 负责存储(必须副本集)
Lua
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
YAML
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
YAML
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
YAML
#步骤