Replica set set-up : host unreachable

Hi, I am getting the following error in my log file when i try and add the nodes to my replicaset


I am not understanding why. I have created all 3 node#.conf files and changed their permissions to 400 and created the keyfile and also made 400 permission

2018-10-28T15:49:23.305+0000 I REPL [conn5] replSetReconfig admin command received from client; new config: { _id: “m103-example”, version: 2, protocolVersion: 1, members: [ { _id: 0, host: “”, arbiterOnly: false, buildIndexes: true, hidden: false, priority: 1.0, tags: {}, slaveDelay: 0, votes: 1 }, { _id: 1.0, host: “” } ], settings: { chainingAllowed: true, heartbeatIntervalMillis: 2000, heartbeatTimeoutSecs: 10, electionTimeoutMillis: 10000, catchUpTimeoutMillis: -1, catchUpTakeoverDelayMillis: 30000, getLastErrorModes: {}, getLastErrorDefaults: { w: 1, wtimeout: 0 }, replicaSetId: ObjectId(‘5bd5d7af13f6a719eb0d7895’) } }
2018-10-28T15:49:23.312+0000 I NETWORK [conn5] getaddrinfo(“”) failed: Name or service not known
2018-10-28T15:49:23.312+0000 I REPL [conn5] replSetReconfig config object with 2 members parses ok
2018-10-28T15:49:23.312+0000 I ASIO [NetworkInterfaceASIO-Replication-0] Connecting to
2018-10-28T15:49:23.317+0000 I ASIO [NetworkInterfaceASIO-Replication-0] Failed to connect to - HostUnreachable: HostUnreachable
2018-10-28T15:49:23.317+0000 I ASIO [NetworkInterfaceASIO-Replication-0] Dropping all pooled connections to due to failed operation on a connection
2018-10-28T15:49:23.317+0000 W REPL [replexec-1] Failed to complete heartbeat request to; HostUnreachable: HostUnreachable
2018-10-28T15:49:23.317+0000 E REPL [conn5] replSetReconfig failed; NodeNotFound: Quorum check failed because not enough voting nodes responded; required 2 but only the following 1 voting nodes responded:; the following nodes did not respond affirmatively: failed with HostUnreachable

1 Like

Fix found from:

From your vagrant machine, do the following:

     vagrant@m103:~$  sudo vi /etc/hosts
  • Go in insert mode by pressing i .
  • Edit the file’s first line, make it instead of, it should look something like this: m103
  • Save the file by pressing Esc and then press :wq . It will exit the editor and you will be back on command line.
  • Check by pinging m103 again.
 vagrant@m103:~$ ping m103
 PING ( 56(84) bytes of data.

It looks like my hostname is not but just m103. I adjusted this in my rs.add() and now it works fine


solved my problem. thanks

1 Like