终于,终于,终于,
解决了。
看到了很多版本的答案,却始终没有解决问题,
查看了源码,看了配置文件,终于解决了。
分享给大家。
Exception in thread "main" org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available:
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:278)at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:197)
at org.elasticsearch.client.transport.support.InternalTransportClient.execute(InternalTransportClient.java:106)
at org.elasticsearch.client.support.AbstractClient.bulk(AbstractClient.java:163)
at org.elasticsearch.client.transport.TransportClient.bulk(TransportClient.java:364)
at org.elasticsearch.action.bulk.BulkRequestBuilder.doExecute(BulkRequestBuilder.java:164)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65)
at com.hansight.utils.EsUtils.importData(EsUtils.java:134)
at com.hansight.utils.EsUtils.main(EsUtils.java:173)
解决思路:
1.查看
luster.name,是否是你服务器上在elasticsearch.yml上配置的
2.查看
port:9300
val client = TransportClient.builder().settings(settings).build() .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("******"), 9300))
3.查看
服务器的防火墙,是否关了。
4.查看
如果设置client.transport.sniff为true,则表示客户端去嗅探整个cluster的状态,把集群中其它机器的ip地址加到客户端中