环境准备:
mongodb版本:3.0mongos:1个
configserver:3个,普通模式组成高可用(非副本集方式)
分片节点:2个,每个分片是三个数据节点组成的副本集(1 primary+1 secondary+1 arbiter)
mongos> sh.status()
--- Sharding Status ---
sharding version: {
"_id" : 1,
"minCompatibleVersion" : 5,
"currentVersion" : 6,
"clusterId" : ObjectId("582d45c13eb0b8dc133631d9")
}
shards:
{ "_id" : "udb-1ywcjr", "host" : "udb-1ywcjr/10.19.27.79:27017,10.19.51.238:27017" }
{ "_id" : "udb-dwk5m0", "host" : "udb-dwk5m0/10.19.35.18:27017,10.19.89.184:27017" }
balancer:
Currently enabled: yes
Currently running: no
Failed balancer rounds in last 5 attempts: 0
Migration Results for the last 24 hours:
No recent migrations
databases:
{ "_id" : "admin", "partitioned" : false, "primary" : "config" }
{ "_id" : "test", "partitioned" : false, "primary" : "udb-dwk5m0" }
{ "_id" : "test1", "partitioned" : false, "primary" : "udb-1ywcjr" }
mongos> use test
switched to db test
mongos> db.test.find()
{ "_id" : ObjectId("582d483bc5bab52092bf33fd"), "name" : "jiangjian" }
{ "_id" : ObjectId("582d483cc5bab52092bf33fe"), "name" : "jiangjian" }
{ "_id" : ObjectId("582d483d