Bobcares

HAproxy Disable Backend | How-to Guide

by | Mar 14, 2024

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.

HAproxy Disable Backend | How-to Guide

Here’s a guide by our experts to help us out with enabling & disabling the backend:

  1. To begin with, install socat on Linux machine as seen below:

    sudo apt install socat

  2. 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

  3. Then, save the configuration file and restart the HAProxy service.

    sudo systemctl restart haproxy.service

  4. 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

  5. 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.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.