Elasticsearch 集群 'master_not_discovered_exception'

标签 elasticsearch

我已经安装了 elasticsearch 2.2.3 并在 2 个节点的集群中配置

节点 1 (elasticsearch.yml)

cluster.name: my-cluster
node.name: node1
bootstrap.mlockall: true
discovery.zen.ping.unicast.hosts: ["ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com", "ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com"]
discovery.zen.minimum_master_nodes: 1
discovery.zen.ping.multicast.enabled: false
indices.fielddata.cache.size: "30%"
indices.cache.filter.size: "30%"
node.master: true
node.data: true
http.cors.enabled: true
script.inline: false
script.indexed: false
network.bind_host: 0.0.0.0

节点 2 (elasticsearch.yml)

cluster.name: my-cluster
node.name: node2
bootstrap.mlockall: true
discovery.zen.ping.unicast.hosts: ["ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com", "ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com"]
discovery.zen.minimum_master_nodes: 1
discovery.zen.ping.multicast.enabled: false
indices.fielddata.cache.size: "30%"
indices.cache.filter.size: "30%"
node.master: false
node.data: true
http.cors.enabled: true
script.inline: false
script.indexed: false
network.bind_host: 0.0.0.0

如果我得到 curl -XGET 'http://localhost:9200/_cluster/state?pretty' 我有:

{
  "error" : {
    "root_cause" : [ {
      "type" : "master_not_discovered_exception",
      "reason" : null
    } ],
    "type" : "master_not_discovered_exception",
    "reason" : null
  },
  "status" : 503
}

进入节点1的日志有:

[2016-06-22 13:33:56,167][INFO ][cluster.service          ] [node1] new_master {node1}{Vwj4gI3STr6saeTxKkSqEw}{127.0.0.1}{127.0.0.1:9300}{master=true}, reason: zen-disco-join(elected_as_master, [0] joins received)
[2016-06-22 13:33:56,210][INFO ][http                     ] [node1] publish_address {127.0.0.1:9200}, bound_addresses {[::]:9200}
[2016-06-22 13:33:56,210][INFO ][node                     ] [node1] started
[2016-06-22 13:33:56,221][INFO ][gateway                  ] [-node1] recovered [0] indices into cluster_state

改为进入节点 2 的日志:

[2016-06-22 13:34:38,419][INFO ][discovery.zen            ] [node2] failed to send join request to master [{node1}{Vwj4gI3STr6saeTxKkSqEw}{127.0.0.1}{127.0.0.1:9300}{master=true}], reason [RemoteTransportException[[node2][127.0.0.1:9300][internal:discovery/zen/join]]; nested: IllegalStateException[Node [{node2}{_YUbBNx9RUuw854PKFe1CA}{127.0.0.1}{127.0.0.1:9300}{master=false}] not master for join request]; ]

哪里出错了?

最佳答案

我用这一行解决了:

network.publish_host: ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com

每个 elasticsearch.yml 配置文件都必须包含您的主机名这一行

关于 Elasticsearch 集群 'master_not_discovered_exception',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37970187/

相关文章:

python - 如何正确检查滚动结束?

elasticsearch - Ngram的 Elasticsearch 索引?

elasticsearch - 多个单词的 Elasticsearch /lucene索引?

json - 预期[END_OBJECT],但得到了[FIELD_NAME],在kibana中可能有太多查询子句错误

json - 使用Elasticsearch Nest客户端和Utf8Json序列化器时如何捕获与任何POCO属性都不匹配的JSON数据的剩余部分

elasticsearch - Spring Data Elasticsearch 字段映射

elasticsearch - Elasticsearch :使用字段时查询字符串的结果不同

Elasticsearch 禁用删除索引

elasticsearch - 如何配置用于在 Google Compute Engine 上备份 elasticsearch 数据的结构?

elasticsearch - Logstash经过的过滤器