I am getting the exception everytime while starting the server,
java.io.IOException: listener timeout after waiting for [60000] ms
at org.elasticsearch.client.RestClient$SyncResponseListener.get(RestClient.java:661) ~[elasticsearch-rest-client-6.0.0.jar:6.0.0]
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:220) ~[elasticsearch-rest-client-6.0.0.jar:6.0.0]
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:192) ~[elasticsearch-rest-client-6.0.0.jar:6.0.0]
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:154) ~[elasticsearch-rest-client-6.0.0.jar:6.0.0]
at com.hng.elastic.index.IndexService.indexExist(IndexService.java:42) ~[classes/:na]
at com.hng.Application.main(Application.java:39) [classes/:na]
Exception in thread "main" com.hng.elastic.exception.IndexApiException: Error when checking for existing index.
at com.hng.elastic.index.IndexService.indexExist(IndexService.java:54)
at com.hng.Application.main(Application.java:39)
2018-01-27 09:15:20.102 WARN 5800 --- [pool-2-thread-1] com.hng.elastic.LoggingFailureListener : The following host just failed 10.***.***.4:9200
There's no bulk operation happening. All servers are accessible through CURL from the same machine I am trying to run my RestClient implementation. Below is my implementation,
@Override
protected RestClient createInstance() throws Exception {
List<String> serverList = serverConfig.getServer();
HttpHost[] hosts = new HttpHost[serverList.size()];
for (int i = 0; i < hosts.length; i++) {
hosts[i] = HttpHost.create(serverList.get(i));
}
logger.info("Initiallizing Elasticsearch RestClient");
RestClient restClient = RestClient.builder(hosts).setMaxRetryTimeoutMillis(60000)
.setDefaultHeaders(Constants.HEADERS).setFailureListener(loggingFailureListener)
.setRequestConfigCallback((b) -> customizeRequestConfig(b)).build();
if (enableSniffer) {
this.sniffer = Sniffer.builder(restClient).build();
}
logger.info("Initiallized Elasticsearch RestClient");
return restClient;
}
private RequestConfig.Builder customizeRequestConfig(RequestConfig.Builder builder) {
return builder.setConnectionRequestTimeout(0).setSocketTimeout(5000).setConnectTimeout(60000);
}