'DNS Resolution for Redis, Elasticsearch and Postgres hosts not working after introducing Spring Wbflux

Everything was working until I introduced Webflux into our Sprint Boot application running on external tomcat inside a docker container. This was needed when I wrote an elasticsearch repository using ReactiveCrudRepository to implement asynchronous save/fetch operations. Now, our Spring Boot apps hosted on docker are not able to connect to any of the datastores.

For Redis the exception is -

Caused by: java.net.UnknownHostException: Failed to resolve 'redis1' after 2 queries

For Elasticsearch -

Caused by: org.springframework.data.elasticsearch.client.NoReachableHostException: Host 'es_host:9200' not reachable. Cluster state is offline.

The data nodes are all hosted on separate instances.

On researching around a bit, I came across several issues with netty's DNS resolver, but there is no standard fix mentioned anywhere. Please advice.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source