Could not find host matching read preference - how i solved

Hi all,

When I tried to add shard for Lab - Configure a Sharded Cluster I was getting error:

    "errmsg" : "Could not find host matching read preference { mode: \"primary\" } for set m103-repl",
    "code" : 133,
    "codeName" : "FailedToSatisfyReadPreference",

In replica I still had one member added with hostname - rs.add(“m103:27002”)
When I removed this and added it back with IP - rs.add(“192.168.103.100:27002”) - I was able to add shard.

2 Likes