above all:
- the version of elasticsearch: 5.6.1
- cluster nodes: six
when the six nodes were well,everything is ok
after kill the 3 data nodes , nothing happened;
but the second day,I found the error log for my application:NoNodeAvailableException
I check the cluster state,the left three nodes all are ok,but cannot connect to;
when resstart the tomcat,everything is ok,I wander to know what's reason for the problem
I already got the error several times.....
the part logs:
[Request processing failed; nested exception is NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{95EkhGDNRkGq35VqnHlRog}{xx.xx.xx.xx}{xx.xx.xx.xx:9300}, {#transport#-2}{8urxHInyRBmRXf80dudBgg}{xx.xx.xx.xx}{xx.xx.xx.xx:9300}, {#transport#-3}{vCXX4k-GRlKrg-_hhX1QyA}{xx.xx.xx.xx}{xx.xx.xx.xx:9300}]]] with root cause
NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{95EkhGDNRkGq35VqnHlRog}{xx.xx.xx.xx}{xx.xx.xx.xx:9300}, {#transport#-2}{8urxHInyRBmRXf80dudBgg}{xx.xx.xx.xx}{xx.xx.xx.xx:9300}, {#transport#-3}{vCXX4k-GRlKrg-_hhX1QyA}{xx.xx.xx.xx}{xx.xx.xx.xx:9300}]]] with root cause
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:363)
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)
the code connect to server:
public static TransportClient getClient() {
if (client == null) {
try {
Settings settings = Settings.builder().put("cluster.name", clusterName).put("client.transport.sniff", true)
.put("transport.type", "netty3").put("http.type", "netty3").build();
client = new PreBuiltTransportClient(settings);
String[] addresses = esServers.split(",");
for (String address : addresses) {
String[] hostInfo = address.split(":");
client.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(hostInfo[0]), Integer.parseInt(hostInfo[1])));
}
} catch (Exception e) {
logger.error("get client fail...", e);
shutdown();
client = null;
}
}
logger.debug("create client is successful ");
return client;
}