Administration
Manage HAProxy Enterprise configuration files
By default, the HAProxy Enterprise service loads only one configuration file, /etc/hapee-<VERSION>/hapee-lb.cfg
.
Optional: Split the load balancer configuration file Jump to heading
You can split the load balancer configuration file into multiple files and then load them all. This type of configuration is typically used for load balancers that support multiple applications.
In this configuration the default configuration file contains the global
directives shared by all applications, and the defaults
, frontend
, and backend
sections for each application are contained in their own configuration file. Thus, for example, if there are two applications, there would be one file for global
directives, a second file containing the defaults
, frontend
, and backend
sections for application A, and a third file containing the defaults
, frontend
, and backend
sections for application B.
Info
Be aware that if you use the Data Plane API to make configuration changes, the API is not compatible with split configuration files and expects there to be only one.
To split the load balancer configuration:
-
Create the directory
/etc/hapee-<VERSION>/lb-conf.d
. For example:nixsudo mkdir /etc/hapee-2.9/lb-conf.d/nixsudo mkdir /etc/hapee-2.9/lb-conf.d/ -
In the
lb-conf.d
directory, create a configuration file for one application, for example,app-A.cfg
. -
Move the application A sections from the main configuration file,
/etc/hapee-<VERSION>/hapee-lb.cfg
, to the application A configuration file/etc/hapee-<VERSION>/lb-conf.d/app-A.cfg
. -
Repeat this process for the remaining applications.
Do not split configuration sections
- A configuration section (such as
global
,defaults
, and so on) must be completely contained in a single file and cannot be split across multiple files.
Configuration file order and names
- Configuration files must have the suffix
.cfg
.
- A configuration section (such as
-
Edit the service environment file:
- On Debian/Ubuntu,
/etc/default/hapee-<VERSION>-lb
- On Alma/Oracle/Redhat/Rocky,
/etc/sysconfig/hapee-<VERSION>-lb
Change the
OPTIONS
line so that it contains the following-f
argument, which loads the files in thelb-conf.d
directory when the HAProxy Enterprise service starts:hapee-2.9-lbtextOPTIONS="-f /etc/hapee-2.9/lb-conf.d/"hapee-2.9-lbtextOPTIONS="-f /etc/hapee-2.9/lb-conf.d/" - On Debian/Ubuntu,
-
Restart the service:
nixsudo systemctl restart hapee-2.9-lbnixsudo systemctl restart hapee-2.9-lb
With this configuration, when the load balancer starts, it first loads the default file containing the global
section. Then it loads the files in the lb-conf.d
directory in lexical sort order.
Validating the configuration Jump to heading
-
Use the
hapee-lb
program’s-c
flag to validate the configuration files.nixsudo /opt/hapee-2.9/sbin/hapee-lb -c -f /etc/hapee-2.9/hapee-lb.cfg -f /etc/hapee-2.9/lb-conf.d/nixsudo /opt/hapee-2.9/sbin/hapee-lb -c -f /etc/hapee-2.9/hapee-lb.cfg -f /etc/hapee-2.9/lb-conf.d/About the configuration checking command
- 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.
- In version 2.8 and earlier, the command indicates a valid configuration by printing
Do you have any suggestions on how we can improve the content of this page?