elasticsearch报 NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u012930316/article/details/81240931

 es版本 :6.3.1 

jdk 1.8

elasticsearch 连接报: 


Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{GRphuiRLRgOVTP0707mGFQ}{192.168.11.216}{192.168.11.216:9200}]]
	at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:347)
	at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:245)
	at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.java:60)
	at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:378)
	at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:405)
	at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:394)
	at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:46)
	at org.elasticsearch.action.ActionRequestBuilder.get(ActionRequestBuilder.java:53)
	at com.es.test.EsTest.addIndex1(EsTest.java:70)
	at com.es.test.EsTest.main(EsTest.java:89)

解决方法:

修改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\config\elasticsearch.yml存在。

然后,特别注意  

java端口9300,http端口9200  

 不要把 9200 端口放代码中去连接...

猜你喜欢

转载自blog.csdn.net/u012930316/article/details/81240931
今日推荐