Learn how to disable the backend in HAproxy. Our HAproxy Support team is here to help you with your questions and concerns.
HAproxy Disable Backend | How-to Guide
Did you know that the option to enable or disable backend servers isn’t available by default when using HAProxy?
However, we can set it up ourselves.
Here’s a guide by our experts to help us out with enabling & disabling the backend:
- To begin with, install socat on Linux machine as seen below:
sudo apt install socat
- Next, open the HAProxy configuration file and add the following lines in the `global` section to enable the stats socket:
global
stats socket /var/run/haproxy.sock mode 600 level admin
stats timeout 2m
- Then, save the configuration file and restart the HAProxy service.
sudo systemctl restart haproxy.service
- Now, we can easily enable or disable your backend servers with these commands:
- To enable a server:
echo "enable server <backend_name>/<server_name>" | socat stdio /var/run/haproxy.sock
- To disable a server:
echo "disable server <backend_name>/<server_name>" | socat stdio /var/run/haproxy.sock
- To enable a server:
- Now, we can check if a server is enabled or disabled by visiting the HAProxy stats page.
That’s it! We can now easily control our HAProxy backend servers without restarting the HAProxy server.
[Need assistance with a different issue? Our team is available 24/7.]
Conclusion
In brief, our Support Experts demonstrated how to disable and enable backend.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
0 Comments