Searching HAProxy Enterprise 1.9r1
Using 'systemd' to Manage HAProxy Enterprise Services
Using 'systemd' to Manage HAProxy Enterprise Services
Linux distributions use systemd
to initialize the user space and subsequently manage all processes.
Note
This section does not apply to Ubuntu 14.04 because it does not use systemd
. Other Linux distributions rely on init scripts
The table below summarizes the services that systemd
manages directly and the ones that sysv
manages. The service list may change based on the subscription level and installed packages.
Service | Init system |
---|---|
| sysv |
| systemd |
| sysv |
| sysv |
| sysv |
| sysv |
Note
The commands listed here apply to both services managed by systemd
or sysv
.
Interaction between systemd and HAProxy
When a system uses systemd
, the following process unfolds:
systemd
starts a wrapper process, which handles communication betweensystemd
and HAProxy. This wrapper process name ishapee-lb-systemd-wrapper
.hapee-lb-systemd-wrapper
then parses the configuration file and starts up a new process calledhapee-lb-master
. Its role is to parse and load the configuration file and to create the required number of HAProxy processes.Running HAProxy processes are called
hapee-lb
.
The process basically gives us the following cgroup
tree. A cgroup
(abbreviated from control groups) is a Linux kernel feature that limits, accounts for, and isolates the resource usage (CPU, memory, disk I/O, network, etc.) of a collection of processes.
Main PID: PID from (hapee-lb-systemd-wrapper)
CGroup: /user/system.slice/hapee-1.9-lb.service
|-PID /opt/hapee-1.9/sbin/hapee-lb-systemd-wrapper ...
|-PIDa /opt/hapee-1.9/sbin/hapee-lb-master
|-PIDb /opt/hapee-1.9/sbin/hapee-lb ...
|-PIDc /opt/hapee-1.9/sbin/hapee-lb ...
systemd
sends signals to hapee-lb-systemd-wrapper
. This process propagates its environment to its descendants. When a reload
occurs, hapee-lb-systemd-wrapper
itself is not reloaded, but passes the information to hapee-lb-master
to run the reload operation.
Enable a service
By default, the services installed with HAProxy Enterprise are not enabled.
To enable a service run systemctl enable <service name>
Output when enabling a systemd
based service:
$ sudo systemctl enable hapee-1.9-lb
Created symlink from /etc/systemd/system/multi-user.target.wants/hapee-1.9-lb.service to /usr/lib/systemd/system/hapee-1.9-lb.service.
Start a service
To start a service run systemctl start <service name>
$ sudo systemctl start hapee-1.9-lb
Stop a service
To stop a service run systemctl stop <service name>
To stop hapee-1.9-lb
:
$ sudo systemctl stop hapee-1.9-lb
Restart a service
To restart a service run systemctl restart <service name>
Example to restart hapee-1.9-lb
:
$ sudo systemctl restart hapee-1.9-lb
Reload a service
To reload a service run systemctl reload <service name>
Example to reload hapee-1.9-lb
:
$ sudo systemctl reload hapee-1.9-lb
Warning
systemd
has a severe limitation concerning reload: the environment variables do not get reloaded during a service reload. You must perform a service restart.
The reason is because hapee-lb-systemd-wrapper
loads environment variables at startup, and these cannot get refreshed at reload. See Interaction between systemd and HAProxy.