1.在三个不同服务器上,分别建立副本集:
202服务器:
192.8.123.202:27017 replSet = r202
192.8.123.202:27018 replSet = r202
192.8.123.202:27019 replSet = r202
203服务器:
192.8.124.203:27017 replSet = r203
192.8.124.203:27018 replSet = r203
192.8.124.203:27019 replSet = r203
204服务器:
192.8.125.204:27017 replSet = r204
192.8.125.204:27018 replSet = r204
192.8.125.204:27019 replSet = r204
2.在202服务器上启动configsvr:
./bin/mongo --help | grep config
启动mongs:
进入mongos:
3.建立分片,202数据库执行:
mongs=> sh.addShard('r202/192.8.124.202:27017') //192.8.124.202:27017主数据库
sh.addShard('r203/192.8.124.203:27017')
sh.addShard('r204/192.8.124.204:27017')
4.手动分片:1000条一块
mongos=>