在使用elasticsearch时报错:
[None of the configured nodes are available: [{#transport#-1}{wXgtIC2KRUyygVQIJeSrFA}{127.0.0.1}{127.0.0.1:9300}]] NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{wXgtIC2KRUyygVQIJeSrFA}{127.0.0.1}{127.0.0.1:9300}]] 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:59) at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:366) at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:408) at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:80) at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:54)
springboot 2.1.6 对应 Elasticsearch 6.3.2 springboot 2.2.5 对应 Elasticsearch 7.6.0 springboot 2.2.6 对应 Elasticsearch 7.7.0
修改elasticsearch.yml时一定要注意使用utf-8编码,英文编写,不然修改过后启动会出现闪退的情况。
修改后elasticsearch.yml:
springboot中,本人使用的properties方式配置,springboot中使用yml同理。:
spring.data.elasticsearch.cluster-name=elasticsearch
# elasticsearch.yml 集群名字 spring.data.elasticsearch.cluster-name=elasticsearch # elasticsearch tcp通信地址 spring.data.elasticsearch.cluster-nodes=127.0.0.1:9300
9200作为Http协议,主要用于外部通讯
9300作为Tcp协议,jar之间就是通过tcp协议通讯
ES集群之间是通过9300进行通讯