Hi BLN,

bln prasad wrote:
> I'm not sure why health check is failing if it's localhost on few
> systems and this is observed with only 1.5.14 version.
> ideally there should not be any difference between localhost and
> 127.0.0.1 right.

Localhost can resolve to several different IPs, including

* any in the network of 127.0.0.0/8, most commonly 127.0.0.1
* ::1 (the defined localhost address in IPv6)

The most common issue here is indeed the difference between IPv4 and
IPv6. If your server is IPv6 aware, HAProxy might try to connect to ::1
only. If your service only listens on 127.0.0.1 however, this will
probably break.

Also, some systems of other local IP addresses than 127.0.0.1 in their
configuration, E.g. some Debian and Ubuntu distributions define the
fixed local hostname as 127.0.1.1. This was added in order to work
around some configuration issues. See
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=316099 for details.

You should have a look at your /etc/hosts file to check this. Generally
(at least right now), it is always a good idea to specify full IP
addresses instead of hostnames in the HAProxy configuration. As
specified hostnames are resolved only once during startup (in HAProxy
1.5), you are thus save from hard to debug issues stemming from
different opinions about a hostname-ip mapping in DNS and in your
running HAProxy processes.

Regards,
Holger

Reply via email to