原创

Elasticsearch分布式安装错误之:handshack failed

记录一个分布式安装elasticsearch时,遇到的一个大坑:

错误配置:

master:
cluster.name: es-cluster
node.name: abe-ubuntu

http.cors.enabled: true
http.cors.allow-origin: "*"

node.master: true
node.data: true
discovery.zen.ping.unicast.hosts: ["192.168.189.150"]
slave01:
cluster.name: es-cluster
node.name: abe01


http.cors.enabled: true
http.cors.allow-origin: "*"

node.master: true
node.data: true
discovery.zen.ping.unicast.hosts: ["192.168.189.150"]
slave02:
cluster.name: es-cluster
node.name: abe02


http.cors.enabled: true
http.cors.allow-origin: "*"

node.master: true
node.data: true
discovery.zen.ping.unicast.hosts: ["192.168.189.150"]
报错信息:
[2017-09-23T00:05:53,647][WARN ][o.e.d.z.ZenDiscovery     ] [abe02] failed to connect to master [{abe01}{hh797yorQAu6i_-3wh9r7w}{_7_HDenIQlu-ZQDhLazvXQ}{127.0.0.1}{127.0.0.1:9300}], retrying...
org.elasticsearch.transport.ConnectTransportException: [abe01][127.0.0.1:9300] handshake failed. unexpected remote node {abe02}{Mcmb0lWYQryu6upJXBc2sw}{ToJgZghMQkyE6REwIVbW2A}{127.0.0.1}{127.0.0.1:9300}
        at org.elasticsearch.transport.TransportService.lambda$connectToNode$3(TransportService.java:336) ~[elasticsearch-5.6.1.jar:5.6.1]
        at org.elasticsearch.transport.TcpTransport.connectToNode(TcpTransport.java:465) ~[elasticsearch-5.6.1.jar:5.6.1]
        at org.elasticsearch.transport.TransportService.connectToNode(TransportService.java:332) ~[elasticsearch-5.6.1.jar:5.6.1]
        at org.elasticsearch.transport.TransportService.connectToNode(TransportService.java:319) ~[elasticsearch-5.6.1.jar:5.6.1]
        at org.elasticsearch.discovery.zen.ZenDiscovery.joinElectedMaster(ZenDiscovery.java:458) [elasticsearch-5.6.1.jar:5.6.1]
        at org.elasticsearch.discovery.zen.ZenDiscovery.innerJoinCluster(ZenDiscovery.java:410) [elasticsearch-5.6.1.jar:5.6.1]
        at org.elasticsearch.discovery.zen.ZenDiscovery.access$4100(ZenDiscovery.java:82) [elasticsearch-5.6.1.jar:5.6.1]
        at org.elasticsearch.discovery.zen.ZenDiscovery$JoinThreadControl$1.run(ZenDiscovery.java:1188) [elasticsearch-5.6.1.jar:5.6.1]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:569) [elasticsearch-5.6.1.jar:5.6.1]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_144]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_144]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_144]

正确配置:

master:
cluster.name: es-cluster
node.name: abe-ubuntu

network.host: 192.168.189.150  # 必须要有,否则报handshake failed错误

http.cors.enabled: true
http.cors.allow-origin: "*"

node.master: true
node.data: true
discovery.zen.ping.unicast.hosts: ["192.168.189.150"]
slave01:
cluster.name: es-cluster
node.name: abe01

network.host: 192.168.189.191

http.cors.enabled: true
http.cors.allow-origin: "*"

node.master: true
node.data: true
discovery.zen.ping.unicast.hosts: ["192.168.189.150"]
slave02:
cluster.name: es-cluster
node.name: abe02

network.host: 192.168.189.192

http.cors.enabled: true
http.cors.allow-origin: "*"

node.master: true
node.data: true
discovery.zen.ping.unicast.hosts: ["192.168.189.150"]
效果图: 这里写图片描述
正文到此结束
Loading...