I have two webservers:
- WEB A: 192.168.0.3
- WEB B: 192.168.0.4
and am using haproxy to load balance between them.
How do I configure haproxy to detect when WEB A or WEB B dies and stop forwarding connections there?
You want to ask haproxy to use HTTP status checks to detect failed servers.
Search the configuration guide for http-check
and httpchk
.
You'll end up with something like:
backend brazzers
mode http
balance roundrobin
option httpchk GET /status HTTP/1.1\r\nHost:\ api.brazzers.com
server bz_00 10.0.0.1:8000 check
server bz_01 10.0.0.2:8000 check