HAProxy health check

user3145921 picture user3145921 · May 7, 2014 · Viewed 10.7k times · Source

My current setup has 2 HAProxies configured with keepalived for High Availability, the 2 proxies serve as a Reverse Proxy and Load Balancer for virtual webservices. I know that HAProxy can check the health of its backend (I've already configured this) but my question is something else.

At my company there's a F5 Big-IP Load Balancer which serves as the first line of defense, it will redirect requests to my HAProxies when needed.

I need to know if there is a way to let my F5 Big-IP check the health of the HAProxies frontend, so when the proxies are booting no requests will be lost.

Thanks

Answer

Pau Ruŀlan Ferragut picture Pau Ruŀlan Ferragut · Aug 3, 2016

There used to be a mode health option but in recent versions the easiest way is to use a monitor-uri on a given port:

listen health_check_http_url
    bind :8888
    mode http
    monitor-uri /healthz
    option      dontlognull

You can use the monitor-uri in a frontend and select it with an ACL too but the port version is much clear and straightforward.

https://cbonte.github.io/haproxy-dconv/1.6/configuration.html#4.2-mode

https://cbonte.github.io/haproxy-dconv/1.6/configuration.html#4.2-monitor-uri