`rs.add()` not working

I have created 3 nodes node 1, node 2, node 3 and did rs.initiate() for the node 1 but I not able to add node 2 and node 3 as secondary node. I am writing rs.add("m103.mongodb.university:27012") for node 2 and rs.add("m103.mongodb.university:27013") for node 3 as I gave port as 27012 and 27013 for node 2 and node 3 respectively.

This is the error.


This is the result from rs.status()



Can you confirm that the 2 nodes you are trying to add are up and running with ss -tnulp?

If they are running there is something in your configuration, related to authentication, that prevent the nodes to talk together. Can you indicate which lab you are trying to do?

Hi @iamaeytee,

Please check the /etc/hosts file for the value of the hostname “m103.mongodb.university”, which should point to “”.

If the value is not rightly set, you can either go ahead and edit the /etc/hosts file or use the absolute value of IP address in your rs.add command.

Please get back to us if the issue still persists.

Curriculum Support Engineer

1 Like

I had the same error message. In reviewing my conf vs the lesson, I believe the issue is caused because in my confi files, I listed ‘localhost’ before the absolute path in the ‘bindIp’ field…

I resolved it, as you recommend, by adding the absolute path plus port in place of the namespaced value

1 Like

It is mentioned in lab that IP should be used instead of hostname, and yes the problem is that fqdn is not in hosts file