Migration

Migrate from HAProxy to HAProxy Enterprise

Migrate an existing HAProxy (Community edition) load balancer to use HAProxy Enterprise instead with a blue-green deployment strategy.

The following migration strategy is a high-level overview and doesn’t cover every use case or application. You will need to adapt your migration plan to your specific use case. It’s recommended to test a migration plan in a pre-production environment before deploying changes to production.

Notable changes migrating from HAProxy to HAProxy Enterprise:

  • The HAProxy Enterprise configuration is located at /etc/hapee-2.9/hapee-lb.cfg instead of HAProxy’s /etc/haproxy/haproxy.cfg
  • The Runtime API socket is located at /var/run/hapee-2.9/hapee-lb.sock instead of HAProxy’s /var/run/haproxy.sock
  • The main service file is called hapee-2.9-lb.service instead of haproxy.service
  • The logs are located at /var/log/hapee-2.9/lb-access-{YEAR,MONTH,DAY}.log and lb-admin-{YEAR,MONTH,DAY}.log instead of HAProxy’s /var/log/haproxy.log

In this overview, you are migrating an HAProxy load balancer to a new HAProxy Enterprise load balancer on two different machines; here’s what the example setup looks like:

An example HAProxy setup where the client device is sending request traffic to an HAProxy load balancer, which then sends the traffic to a group of web servers.

Prerequisite Jump to heading

Obtain an HAProxy Enterprise license key. Don’t have one? Request a free HAProxy Enterprise trial to obtain your trial license key.

Migrate with a blue-green deployment strategy Jump to heading

  1. Install HAProxy Enterprise on a new machine following the Linux Installation procedure.

    An example HAProxy setup where the client device is sending request traffic to an HAProxy load balancer, which then sends the traffic to a group of web servers. In addition, there is a newly created HAProxy Enterprise load balancer waiting to be connected.

  2. Transfer the necessary contents of the HAProxy configuration file to the new, default HAProxy Enterprise configuration file line-by-line. Here’s a list of recommendations:

    • Don’t overwrite the default HAProxy Enterprise configuration file with HAProxy’s configuration file.
    • Don’t transfer the global section from HAProxy; instead, use the default global section that comes with HAProxy Enterprise.
    • Move necessary HAProxy directories and files to the new machine, and rename them accordingly. These files may include TLS certificates, Map files, and ACL files.
    • Update any path names in the HAProxy Enterprise configuration file accordingly.
    • Confirm hard-coded IP addresses in the frontend section.
    • Configure the HAProxy Enterprise load balancer to run on a different IP address than the HAProxy load balancer. This allows you to run both products simultaneously and have the ability to rollback if an issue were to arise.
  3. Validate the HAProxy Enterprise configuration file.

    nix
    /opt/hapee-2.9/sbin/hapee-lb -c -f /etc/hapee-2.9/hapee-lb.cfg -V
    nix
    /opt/hapee-2.9/sbin/hapee-lb -c -f /etc/hapee-2.9/hapee-lb.cfg -V

    Alerts and warnings that appear in the console output explain the errors encountered. Address all the errors until you receive the successful output: Configuration file is valid.

  4. Restart the HAProxy Enterprise service.

    nix
    sudo systemctl restart hapee-2.9-lb
    nix
    sudo systemctl restart hapee-2.9-lb
  5. Confirm that the HAProxy Enterprise process is running.

    nix
    systemctl status hapee-2.9-lb
    nix
    systemctl status hapee-2.9-lb
  6. Confirm that HAProxy Enterprise is listening on the right ports.

    nix
    ss -tlpn
    nix
    ss -tlpn
  7. Check the HAProxy Enterprise admin log files at /var/log/hapee-2.9/lb-admin-{YEAR,MONTH,DAY}.log for messages about startup and the backend server health checks.

  8. Perform the migration by diverting traffic from the existing HAProxy load balancer to only the HAProxy Enterprise load balancer using its IP address.

    An example HAProxy Enterprise setup where the client device is sending request traffic to an HAProxy Enterprise load balancer, which then sends the traffic to a group of web servers. The old HAProxy load balancer is no longer serving traffic.

  9. Verify no warnings or errors by tailing the HAProxy Enterprise access logs:

    nix
    sudo tail /var/log/hapee-2.9/lb-access-{YEAR,MONTH,DAY}.log
    nix
    sudo tail /var/log/hapee-2.9/lb-access-{YEAR,MONTH,DAY}.log
  10. Perform tests to confirm that your application is working as expected. Divert traffic back to the HAProxy load balancer if issues cannot be addressed.

  11. If your application is working as expected and a rollback is no longer needed, then you can tear down HAProxy and the old machine.

    An example HAProxy Enterprise setup where the client device is sending request traffic to an HAProxy Enterprise load balancer, which then sends the traffic to a group of web servers.

If this blue-green deployment strategy is not possible for your use case, contact our Support team to consider alternatives based on your specific needs.

Do you have any suggestions on how we can improve the content of this page?