Administration

Manage the HAProxy Enterprise service

This page applies to:

  • HAProxy Enterprise - all versions

This section describes how to manage the load balancer service on Linux.

Get the HAProxy Enterprise version Jump to heading

To see the installed version of the software:

nix
/opt/hapee-3.3/sbin/hapee-lb version
nix
/opt/hapee-3.3/sbin/hapee-lb version

Start and stop the service Jump to heading

HAProxy Enterprise runs as a service, which you can start or stop by calling systemctl:

Start the service:

nix
sudo systemctl start hapee-3.3-lb
nix
sudo systemctl start hapee-3.3-lb

Stop the service:

nix
sudo systemctl stop hapee-3.3-lb
nix
sudo systemctl stop hapee-3.3-lb

Use the systemctl status command to check whether the service is running:

nix
sudo systemctl status hapee-3.3-lb
nix
sudo systemctl status hapee-3.3-lb
output
text
hapee-3.3-lb.service - HAPEE Load Balancer
Loaded: loaded (/lib/systemd/system/hapee-3.3-lb.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2020-12-02 15:56:43 UTC; 1min 35s ago
Main PID: 12977 (hapee-lb)
Tasks: 3 (limit: 1152)
CGroup: /system.slice/hapee-3.3-lb.service
├─12977 /opt/hapee-3.3/sbin/hapee-lb -Ws -f /etc/hapee-3.3/hapee-lb.cfg -p /ruhapee-3.3-lb.pid
└─12992 /opt/hapee-3.3/sbin/hapee-lb -Ws -f /etc/hapee-3.3/hapee-lb.cfg -p /run/ hapee-3.3-lb.pid
Dec 02 15:56:43 lb1 systemd[1]: Starting HAPEE Load Balancer...
Dec 02 15:56:43 lb1 hapee-lb[12977]: [NOTICE] 336/155643 (12977) : New worker #1 (12992) forked
Dec 02 15:56:43 lb1 systemd[1]: Started HAPEE Load Balancer.
output
text
hapee-3.3-lb.service - HAPEE Load Balancer
Loaded: loaded (/lib/systemd/system/hapee-3.3-lb.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2020-12-02 15:56:43 UTC; 1min 35s ago
Main PID: 12977 (hapee-lb)
Tasks: 3 (limit: 1152)
CGroup: /system.slice/hapee-3.3-lb.service
├─12977 /opt/hapee-3.3/sbin/hapee-lb -Ws -f /etc/hapee-3.3/hapee-lb.cfg -p /ruhapee-3.3-lb.pid
└─12992 /opt/hapee-3.3/sbin/hapee-lb -Ws -f /etc/hapee-3.3/hapee-lb.cfg -p /run/ hapee-3.3-lb.pid
Dec 02 15:56:43 lb1 systemd[1]: Starting HAPEE Load Balancer...
Dec 02 15:56:43 lb1 hapee-lb[12977]: [NOTICE] 336/155643 (12977) : New worker #1 (12992) forked
Dec 02 15:56:43 lb1 systemd[1]: Started HAPEE Load Balancer.

Reload the configuration Jump to heading

Use the reload operation to apply configuration changes to the load balancer.

When you change, add, or remove files such as the load balancer configuration file, map files, cert files, WAF rules, and so on, you need to reload the load balancer to apply the changes.

To reload the configuration without restarting the process, call systemctl reload:

nix
sudo systemctl reload hapee-3.3-lb
nix
sudo systemctl reload hapee-3.3-lb

When the load balancer performs a reload, it applies configuration changes immediately without interrupting existing connections. The load balancer can support graceful, no-impact reloads because of its master-worker architecture.

When the load balancer starts, it starts a master process and a worker process. The master manages the worker, and it manages reloads. The worker validates the configuration and executes the load balancer application that processes traffic.

When you execute a reload command, systemd sends the SIGUSR2 signal to the master process, which causes it to re-execute itself. The master process sends the SIGUSR1 signal to workers to perform a soft stop and create new workers with the changed configuration. The old workers complete their existing connections before terminating. New connections go to the new workers. No connections are dropped.

Dynamic changes are configuration changes made to the load balancer process running in memory. These changes, applied using the HAProxy Runtime API, aren’t written to disk and don’t persist through a load balancer reload or restart. When the process terminates, the dynamic changes are lost. If you want these changes to be persistent, modify the configuration files on disk.

In versions prior to 2.6r1, you must add the expose-fd listeners parameter on the stats socket line in the global section of your configuration for this to work. Versions 2.6r1 and later do not require this.

haproxy
stats socket /var/run/hapee-3.3/hapee-lb.sock user hapee-lb group hapee mode 660 level admin expose-fd listeners
haproxy
stats socket /var/run/hapee-3.3/hapee-lb.sock user hapee-lb group hapee mode 660 level admin expose-fd listeners

More tuning options:

  • Add hard-stop-after to your configuration to limit how long to wait for workers to finish active connections before forcing them to stop. It sets a maximum time to wait. You could use this to prevent long-running sessions from blocking the reload.
  • Add grace to your configuration to pause for a period of time before initiating the soft stop of workers. During this delay, you could send a notification of the pending reload.

Validate the configuration file Jump to heading

Use the hapee-lb program’s -c flag to validate the configuration file.

Depending on your version, the command’s output indicates that the file is valid in these ways:

  • In version 2.8 and earlier, the command indicates a valid configuration by printing Configuration file is valid in addition to setting the zero return status.
  • In version 2.9 and later, the command sets the zero return status for a valid configuration but does not display a message. To display the message, include the -V option on the command line.

Multiple configuration files

If you have multiple configuration files in your application, be sure to check them all in the correct order.

Example:

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

Alerts and warnings that appear in the console output explain the errors encountered. An alert is a fatal condition and prohibits the service from starting. A warning indicates a condition that is not fatal now but may become fatal in a future release. Address all the errors until you receive the successful output: Configuration file is valid.

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