elasticsearch报错解决办法:NoNodeAvailableException[None of the configured nodes are available
ES版本: 2.3.3
JDK版本:1.7.2
------------------------------------------
ES搭建完成后,使用localhost 和127.0.0.1都能正常访问和检索数据,但是使用服务器本机IP确报错。如下错误:
NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{192.168.1.99}{192.168.1.99:9200}]]
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:290)
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:290)
===============================
解决方法:
修改es配置文件(elasticsearch-2.3.3\config\elasticsearch.yml),
修改network.host
network.host:服务器IP地址
补充说明:
如果你的java代码连接方式为下面的代码,要在配置文件中存在此结点。
Settings settings = Settings.settingsBuilder().put("cluster.name","my-application").put("client.transport.sniff", true).build();
client = TransportClient.builder().settings(settings).build().addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(ipAddress1), iPort1));
注意一下,cluster.name在es配置文件(elasticsearch-2.3.3\config\elasticsearch.yml)存在。如下图所示:
cluster.name的名字要在配置文件中存在,否则还会报上面的错误。
转:http://blog.csdn.net/yunfeishiye/article/details/51894513