Elasticsearch:节点已注册到群集但MasterNotDiscoveredException

时间:2015-09-04 10:15:53

标签: elasticsearch spring-boot

我在ElasticSearch节点之间存在通常连接问题的变体,但是在这里它似乎与网络无关,因为客户端向主服务器注册没有任何问题(显然)。我的设置如下:

一个主节点(node.master=truenode.data=truecluster.name=stokker

具有以下设置的一个客户端节点(Spring Boot 1.3.0.M5):

spring.data.elasticsearch.properties.http.enabled=true
spring.data.elasticsearch.cluster-name=stokker
spring.data.elasticsearch.properties.node.local=false
spring.data.elasticsearch.properties.node.data=false
spring.data.elasticsearch.properties.node.client=true

首先我启动主节点,然后是客户端,我可以看到客户端注册OK:

[Kilmer] recovered [0] indices into cluster_state
[Kilmer] watch service has started
[Kilmer] bound_address {inet[/0:0:0:0:0:0:0:0:9201]}, publish_address         {inet[/159.107.28.230:9201]}
[Kilmer] started
[Kilmer] added {[Thunderclap][VVF_5QnLREac-Du-dZK1IQ][ES00052260][inet[/159.107.28.230:9301]]{client=true, data=false, local=false},}, reason: zen-disco-receive(join from node[[Thunderclap][VVF_5QnLREac-Du-dZK1IQ]    [ES00052260][inet[/159.107.28.230:9301]]{client

客户端的控制台输出

org.elasticsearch.node                   : [Thunderclap] version[1.7.0], pid[12084], build[929b973/2015-07-16T14:31:07Z]
org.elasticsearch.node                   : [Thunderclap] initializing ...
org.elasticsearch.plugins                : [Thunderclap] loaded [], sites []
org.elasticsearch.bootstrap              : JNA not found. native methods will be disabled.
org.elasticsearch.node                   : [Thunderclap] initialized
org.elasticsearch.node                   : [Thunderclap] starting ...
org.elasticsearch.transport              : [Thunderclap] bound_address {inet[/0:0:0:0:0:0:0:0:9301]}, publish_address {inet[/159.107.28.230:9301]}
org.elasticsearch.discovery              : [Thunderclap] stokker/VVF_5QnLREac-Du-dZK1IQ
org.elasticsearch.discovery              : [Thunderclap] waited for 30s and no initial state was set by the discovery
org.elasticsearch.http                   : [Thunderclap] bound_address {inet[/0:0:0:0:0:0:0:0:9202]}, publish_address {inet[/159.107.28.230:9202]}
org.elasticsearch.node                   : [Thunderclap] started

但是,当我尝试执行一些索引时,我得到以下异常:

org.elasticsearch.discovery.MasterNotDiscoveredException: waited for [30s]

关于我在这里缺少什么的任何想法?

由于

1 个答案:

答案 0 :(得分:0)

我通过手动添加此属性来指示主节点的位置来解决此问题:

spring.data.elasticsearch.cluster-nodes=192.168.1.18:9300

如果有人找到了更好的解决方案,请告诉我,我对此并不完全自信。