Hi
I believe this is the main issue you’re having:
Last reported error: Could not find host matching read preference { mode: “primary” } for set shard_Repl_SetB
It appears that the Shard B
replica set does not have a primary. This means that no data can be written to the replica set. In other words, MongoDB tried to balance the cluster, but cannot since Shard B
does not accept writes.
One very likely cause if because the Shard B
replica set appears to contain only 2 members. This is not a recommended configuration for a replica set, since a replica set depends on its ability to elect a primary member that can accept writes by simple majority. In a 2-member replica set, if one of them is offline, the remaining node will become a secondary to prevent “split-brain” scenario. Thus the minimum of 3 members is the recommended configuration for a replica set. This is described in detail in the Replication page.
To enable the cluster to balance itself, Shard B
must be writable (e.g. the replica set having a primary). The best way to solve this is to add another data-bearing member to Shard B
replica set.
Best regards
Kevin