Some Linux distributions use the initialization (init) systemd to bootstrap the user space and subsequently manage all processes.
This section applies to Centos 7 and Debian 8 only. The 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.
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 is used to handle communication between systemd and HAProxy. This wrapper process name is
hapee-lb-systemd-wrapperthen parses the configuration file and starts up a new process called
hapee-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
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.7-lb.service |-PID /opt/hapee-1.7/sbin/hapee-lb-systemd-wrapper ... |-PIDa /opt/hapee-1.7/sbin/hapee-lb-master |-PIDb /opt/hapee-1.7/sbin/hapee-lb ... |-PIDc /opt/hapee-1.7/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 HAPEE are not enabled.
To enable a service run
systemctl enable <service name>
Output when enabling a systemd based service:
# systemctl enable hapee-1.7-lb Created symlink from /etc/systemd/system/multi-user.target.wants/hapee-1.7-lb.service to /usr/lib/systemd/system/hapee-1.7-lb.service.
Output when enabling a sysv based service:
# systemctl enable hapee-1.7 hapee-1.7-log.service is not a native service, redirecting to /sbin/chkconfig. Executing /sbin/chkconfig hapee-1.7-log on
Start a service
To start a service run
systemctl start <service name>
systemctl start hapee-1.7-lb
Stop a service
To stop a service run
systemctl stop <service name>
systemctl stop hapee-1.7-lb
systemctl stop hapee-1.7-log
Restart a service
To restart a service run
systemctl restart <service name>
Example to restart
systemctl restart hapee-1.7-lb
Example to stop
systemctl restart hapee-1.7-log
Reload a service
To reload a service run
systemctl reload <service name>
Example to reload
systemctl reload hapee-1.7-lb
Example to reload
systemctl reload hapee-1.7-log
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 that environment variables are loaded by hapee-lb-systemd-wrapper at startup, and they cannot be refreshed at reload. See Interaction between systemd and HAProxy.