Elasticsearch错误在ping期间发现的主节点不足

时间:2018-03-13 10:04:16

标签: amazon-web-services elasticsearch amazon-ec2

 # ======================== Elasticsearch Configuration ========================= 
#cluster.name: my-application 
node.name: node-1 
node.master: true 
node.data: true  
network.host: 172.31.24.193 
discovery.zen.ping.unicast.hosts:["172.31.24.193","172.31.25.87","172.31.23.237"]

node-2 elasticsearch.yml配置

  # ======================== Elasticsearch Configuration ========================= 
#cluster.name: my-application 
node.name: node-2 
node.master: true 
node.data: true  
network.host: 172.31.25.87 
discovery.zen.ping.unicast.hosts:["172.31.24.193","172.31.25.87","172.31.23.237"] 

node-3 elasticsearch配置

  # ======================== Elasticsearch Configuration ========================= 
#cluster.name: my-application 
node.name: node-3 
node.master: true 
node.data: true  
network.host: 172.31.23.237 
discovery.zen.ping.unicast.hosts:["172.31.24.193","172.31.25.87","172.31.23.237"] 

错误说明:我已经安装了ec2-discovery插件。我在弹性密钥库中传递AWS访问密钥和密钥和端点。

我正在使用最新的弹性搜索6.2。我已经启动了amazon ec2实例上的所有节点。我有三个ec2实例。 我在这三个节点上收到错误

[node-2] not enough master nodes discovered during pinging (found [[Candidate{node={node-2}{TpI8T4GBShK8CN7c2ruAXw}{DAsuqCnISsuiw6BGvqrysA}{172.31.25.87}{172.31.25.87:9300}, clusterStateVersion=-1}]], but needed [2]), pinging again

1 个答案:

答案 0 :(得分:2)

首先, 要使用ec2-discovery,你需要在elasticsearch.yml中使用它:    discovery.zen.hosts_provider: ec2 并删除discovery.zen.ping.unicast.hosts
请检查https://www.elastic.co/guide/en/elasticsearch/plugins/current/discovery-ec2-usage.html
ec2-discovery的想法不是硬编码配置文件中的节点IP,而是自动发现'它们。

其次, 您提供的错误表明节点无法相互ping通,请确保在安全组中设置规则以允许此操作。在InBound选项卡中,添加新规则:
类型:所有TCP
来源:您的安全组ID(sg-xxxxxx)