mavrl
mavrl

Reputation: 1

mongodb secondary replica cannot connect to primary set

I set up a 3 replica sets. After adding 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. The mongodb version I am using is: 3.2.9

Thanks,

Upvotes: 0

Views: 3769

Answers (1)

Waheed
Waheed

Reputation: 648

In your case it seems replicaset machines are not able to connect to each other, have you tried to telnet from primary to secondaries using telnet secondary_n 27017 and from secondaries to primary telnet primary 27017. if you were able to initiate a session then there is not any network communication issue. If you were not able to initiate telnet session then you have to look deeper into your iptables on all the other machines.

Upvotes: 2

Related Questions