连接elasticsearch已经成功,但是会报以下错误,字面意思是节点不可用这样
Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{q-OhKPN_TjaYVSUpgbNQGQ}{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:60) at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:371) at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:405) at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:394) at org.elasticsearch.client.support.AbstractClient$IndicesAdmin.execute(AbstractClient.java:1247) at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:46) at com.lin.TestClient.main(TestClient.java:47)
除了网上提到的常见问题,例如cluster.name,port不匹配(默认访问url端口是9200,但是连接端口是9300)之外,还要留意引进的transport的版本有没有问题。
找到安装目录下的日志F:elasticsearch-7.5.0-windows-x86_64elasticsearch-7.5.0logmy-application_server.json,有输出过下面的问题:
2020-02-15T00:18:53,334+08:00", "level": "WARN", "component": "o.e.t.TcpTransport", "cluster.name": "my-application", "node.name": "DESKTOP-R3BLRIN", "message": "exception caught on transport layer [Netty4TcpChannel{localAddress=/127.0.0.1:9300, remoteAddress=/127.0.0.1:11931}], closing connection", "cluster.uuid": "HXtKTVCFSTiibfJBiea7tw", "node.id": "9juaKZHLQCWgm0G9oIe_kw" , "stacktrace": ["java.lang.IllegalStateException: Received message from unsupported version: [6.2.4] minimal compatible version is: [6.8.0]",
试下按提示修改下版本。