Skip to content

health check with DefaultReactiveElasticsearchClient #1759

Closed
@iashaposhnikov

Description

@iashaposhnikov

When one node is turned off from the elastic search cluster (to which there was a successful request from the application before), the application switches to the unhealthy status.
This happens because the ReactiveHealthContributor uses the DefaultReactiveElasticsearchClient, and it does not correctly process the data from the hostProvider.
The problem is that ConnectException is wrapped in another exception.
https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/java/org/springframework/data/elasticsearch/client/reactive/DefaultReactiveElasticsearchClient.java#L544
ex

I see the following message in the logs:

139926 2021-04-04 14:26:40,334 WARN  [ reactor-http-epoll-3 ] o.s.b.a.e.ElasticsearchReactiveHealthIndicator          | Elasticsearch health check failed 
org.springframework.web.reactive.function.client.WebClientRequestException: finishConnect(..) failed: Connection refused: <hostname>/<ip>:9200; nested exception is io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: <hostname>/<ip>:9200
	at org.springframework.web.reactive.function.client.ExchangeFunctions$DefaultExchangeFunction.lambda$wrapException$9(ExchangeFunctions.java:141)
	Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Error has been observed at the following site(s):
	|_ checkpoint ⇢ Request to GET http://<hostname>:9200/_cluster/health/ [DefaultWebClient]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions