We want to be able to add more backend servers on demand. Right now I don't see a way to add more backend servers to the config file without restarting haproxy.
We want to be able to add more backend servers on demand. Right now I don't see a way to add more backend servers to the config file without restarting haproxy.
I haven't tested this specific use case but haproxy does support a "hot reload":
If you have an init script to start and stop haproxy it likely supports the
reload
argument with a function like:From the manual:
> 1.6) Helping process management
Haproxy now supports the notion of pidfile. If the '-p' command line argument, or the 'pidfile' global option is followed with a file name, this file will be removed, then filled with all children's pids, one per line (only in daemon mode). This file is NOT within the chroot, which allows to work with a readonly chroot. It will be owned by the user starting the process, and will have permissions 0644.
Example :
Also depending on your HA-proxy version you might want to consider the HA-Proxy Dynamic API as described by haproxy.com in this page: https://www.haproxy.com/blog/dynamic-scaling-for-microservices-with-runtime-api/
The HA-Proxy Dynamic API comes with the Enterprise version.
You should consider the HA-Proxy Dynamic API if you want to add/remove servers on the fly as a usual practice or if your project implies such a use case.