打开 elasticsearch 时,出现以下配置错误:
[2015-04-21 20:49:45,635][INFO ][discovery.zen ] [Blackwulf] failed to send join request to master [[Conquistador][HzGNMjroRCuoHsoTyI3zag][elastic02][inet[/10.70.121.114:9300]]], reason [RemoteTransportException[[Conquistador][inet[/10.70.121.114:9300]][internal:discovery/zen/join]]; nested: NotSerializableTransportException[[org.elasticsearch.transport.ConnectTransportException] [Blackwulf][inet[/10.70.112.23:9300]] connect_timeout[30s]; No route to host; ]; ]
即使可以通过 telnet 访问主机:
[root@elastic05 ~]# telnet 10.70.121.114 9300
Trying 10.70.121.114...
Connected to 10.70.121.114.
Escape character is '^]'.
^]
telnet> quit
Connection closed.
[root@elastic05 ~]# telnet 10.70.121.114 9200
Trying 10.70.121.114...
Connected to 10.70.121.114.
Escape character is '^]'.
^]
telnet> quit
Connection closed.
我还发现即使本地主机在启动时也无法找到路由:
[2015-04-21 20:24:18,291][INFO ][node ] [Ezekiel Stane] version[1.4.1], pid[1347], build[89d3241/2014-11-26T15:49:29Z]
[2015-04-21 20:24:18,292][INFO ][node ] [Ezekiel Stane] initializing ...
[2015-04-21 20:24:18,306][INFO ][plugins ] [Ezekiel Stane] loaded [cloud-aws], sites []
[2015-04-21 20:24:21,558][INFO ][node ] [Ezekiel Stane] initialized
[2015-04-21 20:24:21,558][INFO ][node ] [Ezekiel Stane] starting ...
[2015-04-21 20:24:21,684][INFO ][transport ] [Ezekiel Stane] bound_address {inet[/0.0.0.0:9300]}, publish_address {inet[/10.70.112.23:9300]}
[2015-04-21 20:24:21,696][INFO ][discovery ] [Ezekiel Stane] elasticsearch/f5p3lsxyTfukHZ2E8_G4vQ
[2015-04-21 20:24:21,737][WARN ][transport.netty ] [Ezekiel Stane] exception caught on transport layer [[id: 0x3d524f37]], closing connection
java.net.NoRouteToHostException: No route to host
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.connect(NioClientBoss.java:152)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.processSelectedKeys(NioClientBoss.java:105)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:79)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)
at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
我在 elasticsearch.yml 中列出了主机,通过单播而不是多播(我已禁用)进行连接。
答案1
给你的集群命名,问题就解决了。
config/elasticsearch.yml
在您的 elasticsearch 目录中编辑。
取消注释cluster.name: elasticsearch
并将其更改为类似cluster.name: your_hostname
然后尝试再次启动 elasticsearch。
答案2
No route to host
这些天通常意味着您收到了 ICMP 管理禁止消息 - 即您被防火墙拒绝。
据我所见,它们在 Red Hat 系统上尤其常见,但我希望您也能在其他地方看到它们。
这使得它更容易与“连接被拒绝”区分开来(这仅意味着没有任何内容在监听,或者连接已被重置——可能是由防火墙重置)。
您可以使用tcpdump -p -nn icmp
或类似方法验证这一点,并在连接时查找 ICMP 管理禁止消息。
不管怎样,你得到的结果非常晦涩难懂No route to host
而不是更容易理解,原因有二:
- ICMP 管理禁止消息是(IIRC)ICMP 中不可达代码空间的一部分;
- 错误代码被锁定在 Berkeley Sockets API 中,没有任何其他有用的错误(即 errno)可以将其映射到。
结果,我发现自己必须培训每一位遇到的顾问。