Mongodb remove fragments - Can not have more than one drainage fragment at a time

advertisements

I have a mongodb cluster consisting of 8 shards containing a number of databases. We have sharded the collections which are big and left the others unsharded. Sometime back in the past when we were running 2.0, we removed two shards, so these two shards went into draining. As there were unsharded collections on these shards the draining could never finish.

Now when we have upgraded the cluster to 2.2, I tried to get rid of these two shards ( the draining ones). So I moved all the primaries to other shards and tried to remove the shard, I got this :

mongos> db.runCommand( { removeShard: "shard0000" } )
{ "ok" : 0, "errmsg" : "Can't have more than one draining shard at a time" }

Now I can not remove any of the shards. I am hoping that someone will know what is going on and how to fix it.

Thanks in advance.


I thought it would be good to answer this question myself as later on I could find how to get rid of this situation. What I did was : Firstly, moved the primaries from the shard to another shard. When all primaries are moved to another shard then I removed the entry from the config.shard collection manually. And finally restarted mongos. If you have more than one mongos then restart all mongos'.