A problem in the last step of (Lab - Initiate a Replica Set Locally)

In the last step in the lab, I start the other two mongod processes with their configuration files.
After that I connected to Primary:

mongo --host “m103-repl/192.168.103.100:27001” -u “m103-admin” -p “m103-pass” --authenticationDatabase “admin”

Now I’m connected, when I tried to add replica set:

rs.add(“m103.mongodb.university:27002”)

I get the message:

MongoDB Enterprise m103-repl:PRIMARY> rs.add(“m103.mongodb.university:27002”)
{
“ok” : 0,
“errmsg” : “Quorum check failed because not enough voting nodes responded; required 2 but only the following 1 voting nodes responded: 192.168.103.100:27001; the following nodes did not respond affirmatively: m103.mongodb.university:27002 failed with Connection refused”,
“code” : 74,
“codeName” : “NodeNotFound”,
“operationTime” : Timestamp(1561733782, 1),
“$clusterTime” : {
“clusterTime” : Timestamp(1561733782, 1),
“signature” : {
“hash” : BinData(0,“hZR7LFAV7H0of7LdftJcMqFIV1M=”),
“keyId” : NumberLong(“6707315010139324417”)
}
}
}

What should I do to fix that?

Are you able to ping m103.mongodb.university?
What does it say?
You may have to edit your /etc/hosts to fix this
alternatively you can add using ip address

Yes it worked with ip address like this:

rs.add(“192.168.103.100:27003”)

Thank you.

2 Likes

Thank you for this note.