Can the HAProxy binary be upgraded without downtime?

Viewed 47

From my understanding it is possible to update the NGINX binary in place without losing connections, as shown here. Is it possible to do the same thing with HAProxy? A quick search didn’t seem to indicate yes, but perhaps I’m missing something?

1 Answers

Well I don't think that HAProxy provides any builtin solution for this. However, you can achieve somewhat similar like that is happening in the link mentioned, by virtue of linux iptables. The steps should be like this:

  1. Route the traffic using iptable rules from the existing port to the currently running local port of haproxy.
  2. Install the new binary in a separate folder different from where the existing binary is lying.
  3. Start another haproxy process on a different port with same configs.
  4. Reroute the traffic from the initial port to the new port. A guide on how to achieve this without any packet loss can be found here.
  5. If all works fine on the new port, stop the previous process otherwise you could revert back to the old process following step 4.
Related