配置节点:
conf27917
dbpath=/home/mongodb/confing/data
replSet=configs
port=27917
fork=true
configsvr=true
conf27918
logpath=/home/mongodb/logs/confing27918.log
dbpath=/home/mongodb/confing/data27918
replSet=configs
port=27918
fork=true
configsvr=true
通过admin 进入配置节点:
rs.reconfig({_id: 'configs', members: [{_id: 0, host: '192.168.78.30:27917'}, {_id: 1, host: '192.168.78.30:27918'}]})
路由节点
route27919
port=27919
logpath=/home/mongodb/logs/route.log
logappend=true
fork=true
bind_ip = 0.0.0.0
configdb=configs/192.168.78.30:27918,192.168.78.30:27917
添加分片配置
sh.addShard("192.168.78.30:27920")
sh.addShard("192.168.78.30:27921")
分片节点
sd27920.cnf
logpath=/home/mongodb/logs/sd27920.log
dbpath=/home/mongodb/confing/data27920
port=27920
fork=true
shardsvr=true
sd27921.cnf
logpath=/home/mongodb/logs/sd27921.log
dbpath=/home/mongodb/confing/data27921
port=27921
fork=true
shardsvr=true