I am setting up HAProxy for a simple backend server. This is my haproxy.cfg
file:
global user haproxy group haproxy stats socket /var/run/haproxy.sock mode 660 level admin expose-fd listeners daemonfrontend webapp mode http bind *:80 default_backend webserversbackend webservers mode http balance roundrobin server s1 web1:5000 check server s2 web2:5000 checklisten stats bind *:9999 mode http stats enable stats uri /stats stats hide-version
Now, after sending requests to port :80
and starting my HAProxy container I pull up the HAProxy stats page and see the following:
Notice how, even though I did not explicitly defined it in the haproxy.cfg
file, layer 4 health checks are being performed on these servers. Now I use the Runtime API to add a server, explicitly:
echo "add server webservers/s3 10.89.1.47:5000 check" | socat stdio /var/run/haproxy.sock
and also switch the state to ready,
echo "set server webservers/s3 state ready" | socat stdio /var/run/haproxy.sock
Then I see the following in the HAProxy stats page:
The requests are now being load balanced across the new server, which is great. However, I noticed that its status is 'no check', indicating that no health checks are being performed on the new server. I'm confident that my added server is up and running, and handling requests effectively. Nevertheless, I would like it to have the same status as the default servers, which undergo health checks. Can you please advise why there are no health checks being performed on my new server, while the default servers are being checked?
I already tried adding the option tcp-check
but this did not work. Also, as I understand, I should not set option tcp-check
if my mode is mode http
.