Chapter3, lab 2 - Setting up a sharded Cluster MongoS "configDB" value


I am on the second lab of chapter 3, trying to set up a sharded cluster. I have created the 3-node Config server replica set and I am about to start up a MongoS process.

The sample config file came with lab has the following for “configDB” parameter:
configDB: m103-csrs/

However, if I follow the lecture prior to the lab, the configDB should contain information on all 3 config servers, i.e.:

configDB: m103-csrs/,,

So, which is it? Do I need all 3 config server nodes, or having only the primary node is good enough?

Roya Yazdani

Here’s an excerpt from the addShard() documentation.

Whether you type out/specify 1, 2 or 3 hostnames in the addShard() param, you will still end up with a 3 node config server that’s linked to the mongos. The only reason why you would type out more than one hostname is for the purpose of discovering the replica set to make a connection, i.e. seed lists. The more hostnames you specify, the quicker/better the replica set can be discovered. It has no bearing on the number of nodes that will become available to mongos… the entire replica set will be used.

It’s the same principle that’s applied when you want to establish a mongo connection to a replica set, you would do something like this: mongo --host "replicaset_name/host1:port1, host2:port2, host3:port3", so that if one node goes down, the replica set is still discoverable from the other two hostnames.

1 Like

Thanks @007_jb

I will use the sample given in the lab then.

Best regards,