mongodb replica set connection HostUnreachable: HostUnreachable error

2,319 views
Skip to first unread message

Chen Zheng

unread,
Nov 24, 2016, 6:44:02 AM11/24/16
to mongodb-user
Hi all, 

I set up a 3 replica sets. After add members to primary node, both secondary nodes could not connect to primary node with error in log file as below: 

2016-11-23T21:33:48.024-0800 I REPL     [ReplicationExecutor] Error in heartbeat request to xxx:27017; HostUnreachable: HostUnreachable

2016-11-23T21:33:48.024-0800 I ASIO     [NetworkInterfaceASIO-Replication-0] Connecting to xxx:27017

2016-11-23T21:33:48.025-0800 I ASIO     [NetworkInterfaceASIO-Replication-0] Failed to connect to xxx:27017 - HostUnreachable: HostUnreachable

2016-11-23T21:33:48.025-0800 I REPL     [ReplicationExecutor] Error in heartbeat request to xxx:27017; HostUnreachable: HostUnreachable

2016-11-23T21:33:48.025-0800 I ASIO     [NetworkInterfaceASIO-Replication-0] Connecting to xxx:27017


I have tried several way to debug by changing setting in mongod configure files:

In configure file, I have set up:


1. bind_ip=127.0.0.1,132.239.xxx.xxx            The second ip 132.239.***.*** is each server's ip address in internal network


2. keyFile=/share/mongo/secret       Every replica set using the same keyFile copy. 


3. mongo 132.239.xxx.xxx/test        This command has been execute on each server to make sure they could access other's running mongod instance through internet. 


4. iptables -A INPUT -s 132.239.***.** -j ACCEPT         The server's system is ubuntu 16.04, so I use iptables rule to make sure each secondary server' ip address will not be block on primary node for data transferring. 


Any help will be really appreciate. 


Thanks, 

Ankur Raina

unread,
Dec 15, 2016, 2:03:31 AM12/15/16
to mongodb-user

Hi Chen,

Please post the output of command rs.conf(), hostname -f and the contents of /etc/hosts file (from all three servers). Since the mongod log output is redacted, I’m not sure whether you are connecting using the hostname or the ip-address of each member.

2016-11-23T21:33:48.025-0800 I ASIO [NetworkInterfaceASIO-Replication-0] Failed to connect to xxx:27017 - HostUnreachable: HostUnreachable

It is unclear if “xxx” here is the hostname or the IP address. It is possible that the configured hostnames may not be resolvable from the point of view of each of the replica set members.

The HostUnreachable error is typically caused by DNS issues, networking setup issues, or from a host being offline.

Regards,
Ankur

Reply all
Reply to author
Forward
0 new messages