Mongodb – Mongo DB sharded cluster fails when one shard is down

mongodbreplicationsharding

I am using Mongo Sharded cluster with two shards.
There was an issue on my one shard and and it was down for around 30 minutes.
It stopped my writes to other shards also.
Logically if one shard is down other shard must be able to take part of writes but allow rites got failed in that duration.

Command failed with error 133: 'could not find host matching read preference { mode: "primary", tags: [ {} ] } for set firstset' on server xxxx . The full response is { "code" : 133, "ok" : 0.0, "errmsg" : "could not find host matching read preference { mode: \"primary\", tags: [ {} ] } for set firstset" }

Could you please help me why this happened.

Mongo version : 3.2.9
Shard Key contentID : alphanumeric value

https://docs.mongodb.com/manual/sharding/#high-availability

Thanks
Virendra Agarwal

Best Answer

You have understood concept cluster and sharding wrong or you are mixing it with ideas of replica set. If cluster misses part of it (shard(s)), it is not whole and cannot function.

Replica set can function when minority of nodes are missing and that's why (sharded) cluster is normally made from replica sets. So, that every shard in the cluster is replica set, at least three nodes. So, in two shard cluster, you have actually six data nodes (2x3) and top of that you have three node config server replica set.