Mongodb – Mongos not returning existing data in shards

mongodbsharding

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

Best Answer

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.