I am seeing this line in many mongoDB links
Use CNAMEs to identify your config servers to the cluster so that you
can rename and renumber your config servers without downtime
I need some help in how set or add CNAMEs
to my mongo config servers.
Can anyone help me with a brief explanation on how to implement that in a shard instance?
Best Answer
So, you give a 'dnsname' to your config servers. For example mongoCfg1, mongoCfg2 and mongoCfg3.
Those dns you can register on a dns server, or in the hosts files of your mongo-servers:
In your mongos config file or startup parameters or even the replication/shard configuration in your mongodb, it is adviced to use those CNAMES.
Example of mongos with cname as configdb parameters:
In case you need to replace a server, let's say mongoCfg2 needs to be replaced, then you can change the ip for mongoCfg2 in all the hosts files so they will refer to the new config server.