Elasticsearch error not enough master nodes discovered during pinging (Although I am able to ping its IP)

I am trying to set up Elastic Search cluster with two nodes but I keep getting this error.

[o.e.d.z.ZenDiscovery     ] [master-node] not enough master nodes discovered ?during pinging (found [[Candidate{node={master-node}{EzeNCWZBR0aAKUP6Va9ZwA}{ZFq4O019Q2WVEWiISBQi2g}{ip-172-31-6-165}{172.31.6.165:9300}{ml.machine_memory=8369979392, xpack.installed=true, ml.max_open_jobs=20, 
ml.enabled=true}, clusterStateVersion=-1}]], but needed [2]), pinging again

Here are my node configuration

1. Master Node
    cluster.name: prod-analytic-stats
     node.name: master-node
     path.data: /var/lib/elasticsearch
     path.logs: /var/log/elasticsearch
     network.host: ip-172-31-6-165
     discovery.zen.ping.unicast.hosts: ["ip-172-31-21-37", "ip-172-31-6-165"]
     discovery.zen.minimum_master_nodes: 2



2. data node
     cluster.name: prod-analytic-stats
     node.name: replica-node
     path.data: /var/lib/elasticsearch
     path.logs: /var/log/elasticsearch
     network.host: ip-172-31-21-37
     discovery.zen.ping.unicast.hosts: ["ip-172-31-21-37", "ip-172-31-6-165"]
     discovery.zen.minimum_master_nodes: 1

However I am able to ping data node from master node

root@ip-172-31-6-165:/etc/elasticsearch# ping 172.31.21.37
PING 172.31.21.37 (172.31.21.37) 56(84) bytes of data.
64 bytes from 172.31.21.37: icmp_seq=1 ttl=255 time=1.18 ms
64 bytes from 172.31.21.37: icmp_seq=2 ttl=255 time=1.07 ms
64 bytes from 172.31.21.37: icmp_seq=3 ttl=255 time=1.14 ms
64 bytes from 172.31.21.37: icmp_seq=4 ttl=255 time=1.08 ms
64 bytes from 172.31.21.37: icmp_seq=5 ttl=255 time=1.16 ms
64 bytes from 172.31.21.37: icmp_seq=6 ttl=255 time=1.12 ms
64 bytes from 172.31.21.37: icmp_seq=7 ttl=255 time=1.21 ms
64 bytes from 172.31.21.37: icmp_seq=8 ttl=255 time=1.05 ms
--- 172.31.21.37 ping statistics ---
8 packets transmitted, 8 received, 0% packet loss, time 7008ms
rtt min/avg/max/mdev = 1.051/1.131/1.219/0.068 ms

I am using Elastic Search 6.3.1 for both the nodes

Pinging does not mean the ports are accessible. Are you able to telnet to port 9300 on the other host from each host?

If both your nodes are master-eligible, you should also make sure discovery.zen.minimum_master_nodes is set to 2 on both nodes.

Yes you are right. I am not able to telnet on port 9300 or 9200.
I receive following error.

[root@ip-172-31-21-37 elasticsearch]# telnet ip-172-31-6-165 9300
Trying 172.31.6.165...
telnet: connect to address 172.31.6.165: Connection timed out

What shall I do to resolve this?

You probably have some firewall blocking access, so need to address that.

Yes issue resolved.
I could not telnet the one host from the other host.
Which was due to firewall settings that I changed.
Now its working perfectly.

Thank you

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.