使用elasticsearch的时候出现错误(一)

xiaoxiao2021-02-28  14

NoNodeAvailableException[None of the configured nodes are available….

错误相关信息

NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{10.6.51.17}{10.6.51.17:9300}]] at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:290) at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:207) at org.elasticsearch.client.transport.support.TransportProxyClient.execute(TransportProxyClient.java:55) at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:288) at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:359) at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:86) at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:56) at com.util.ESClient.search(ESClient.java:414) at com.controller.IndexController.getIndex(IndexController.java:171) at sun.reflect.GeneratedMethodAccessor46.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) ...... ......

解决方法

保持代码中集群名与elaticsearch.yml的配置一致

代码中集群名为默认的elasticsearch。

Settings settings = Settings.settingsBuilder().put("cluster.name","elasticsearch").put("client.transport.sniff", true).build();

elaticsearch.yml

cluster.name: elasticsearch 改系统配置 1.vim /etc/sysctl.conf 2.在末尾添加: net.ipv4.tcp_keepalive_time=600 net.ipv4.tcp_keepalive_intvl=60 net.ipv4.tcp_keepalive_probes=3 3.sysctl -p时期立即生效

到此为止,重启es即可。暂时记录修改方法,日后会更新博客写明原因。

转载请注明原文地址: https://www.6miu.com/read-450057.html

最新回复(0)