So we have a configuration of 2 shard (each is a replica set) and one sharded collection.

There are around 10 million records in each shard. We are using mongo 2.6.4 version. We have sharded with hash_id shard key which we generated specific for sharding.

We are fetching data by id from mongos and most of the queries work but for some of the queries (around 10k) mongos returns null although they exists in one of the shards and we can fetch it from shard directly.

Does anyone knows why mongos or config server don't have information for some ids and is there any way of fixing it? Is there any kind of operation that would refresh data in config servers to have informations about all records in database?

Thanks, Ivan

  • Please elaborate: What do you mean by fetching directly? Directly connecting to the replica set primary / single instance of that shard? Have you checked the config servers log output? Just to prepare you: there is no easy way to restore the metadata. My suggestion: make a backup of said collection from each shard. ASAP. Nov 4, 2015 at 9:57

2 Answers 2


issue flushRouterConfig command, and give a try. It enforces mongos to flush cached metadata which is out of date.

Let me know if it doesn't work.


One solution is mongodump that collection from both replica sets (shards) and then remove it from cluster. Recreate it with sharding enabled and then mongoimport all data from both dump files.

However, if one node could have that much disk space that it can handle all documents, you can drain that other shard (i.e. move all documents to one shard) and after that you add that other shard back and let balancer to equalize your cluster.

Latter one have that advance that there is no need for maintenance break, system is serving clients all the time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.