Elasticsearch错误,在ping期间发现的主节点不足(尽管我能够ping通其IP)

时间:2018-09-11 05:50:31

标签: elasticsearch

我正在尝试建立一个具有两个节点的Elastic Search集群,但我一直收到此错误。

[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

这是我的节点配置:

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

但是我能够从主节点ping数据节点。

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

1 个答案:

答案 0 :(得分:0)

discovery.zen.minimum_master_nodes在所有节点上必须具有相同的值。如果您在两个节点上都将其设置为2,则两个节点都必须是合格的主节点,即node.master: true

如果将其设置为1,则仅单个节点需要具有node.master: true

在您的情况下,数据节点minimum_master_nodes: 1上有ip-172-31-21-37,而主节点minimum_master_nodes: 2上有ip-172-31-6-165,所以它不起作用。