目前集群架构
mongos + config server * 3 + shard * 2 ( replication * 3)
首先使用mongo终端连接到mongos.
检查 balancer 是否开启 (必须为开启)
mongos> sh.getBalancerState()
true
确定要删除的分片的名字,查看分片状态
mongos> db.printShardingStatus()
--- Sharding Status ---
sharding version: {
"_id" : 1,
"minCompatibleVersion" : 5,
"currentVersion" : 6,
"clusterId" : ObjectId("5dfba2392238d44d0911df5a")
}
shards:
{ "_id" : "shard1", "host" : "rs-shard1/xxx.xxx.xxx.xxx:27017,xxx.xxx.xxx.xxx:27017,xxx.xxx.xxx.xxx:27017", "state" : 1 }
{ "_id" : "shard2", "host" : "rs-shard2/xxx.xxx.xxx.xxx:27017,xxx.xxx.xxx.xxx:27017,xxx.xxx.xxx.xxx:27017", "state" : 1 }
databases:
{ "_id" :