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

 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 端口放代码中去连接...

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值