Reputation: 197
I setup a cluster on aws that looks like this
- mycluster
--- shard0
----- node0 : P
----- node1 : S
----- node2 : S
--- shard1
----- node0: P
----- node1: S
----- node2: S
--- shard2
----- node0: P
----- node1: S
----- node2: S
I want to connect to it via a connection string URI.
My connection string currently look like this:
mongodb://host0:portX,...,host9:portZ/test-database?replicaSet=mycluster
but for some reason I get the error not reachable when I attempt to connect with it.
However, I can connect to a single shard just fine.
mongodb://host0:portX,...,host3:portZ/test-database?replicaSet=shard0
What am I missing here that is preventing me from connecting to the whole cluster?
Upvotes: 0
Views: 5929
Reputation: 28550
In a shard you connect to the shard router, i.e. the mongos process. You don't connect to every individual shard. Only mongos does that.
Upvotes: 5