Publishing a hostname instead of an ip address

I'm trying to set up my v5 cluster to publish a host name instead of an IP address as it's endpoint.

The problem is, that even if I type a hostname in the elasticsearch.yml file, then it will resolve that hostname to an IP, and use that as the publish addresse.

The scenario is this:

The hostname I want all clients to use is es.example.local. The hostname resolves to different IP's depending on the clients location:

ES-server:
IP: 10.10.20.150
es.example.local resolves to 127.0.0.1

Proxy server:
IP: 10.250.9.150
Forwards 10.250.9.150 to 10.10.20.150

Client A:
es.example.local resolves to 10.250.9.150

Client B:
es.example.local resolves to 10.10.20.150

Now, when using the NEST client in my project, Client A and B will start by requesting

http://es.example.local:9200/_nodes/http,settings?flat_settings&timeout=2s&pretty=true

After that, both clients will start using 10.10.20.150 for their http requests.

This works well for Client B, but Client A cannot reach 10.10.20.150.

If I set http.publish_host to es.example.local, then both clients will start trying to connect to 127.0.0.1, because that is what this hostname resolves to on the ES server.

Is there any way for me to publish a hostname to the clients, that they can use, instead of an IP address? That way all the clients can resolve the hostname to the IP they need, and the proxy can then forward the request to the actual ES server.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.