Administration
Manage HAProxy Enterprise configuration files
By default, the HAProxy Enterprise service loads only the configuration file, /etc/hapee-<VERSION>/hapee-lb.cfg
.
Validate your configuration Jump to heading
You can validate a configuration file using the hapee-lb
program with the -c
flag:
nix
sudo /opt/hapee-3.0/sbin/hapee-lb -c -f /etc/hapee-3.0/hapee-lb.cfg
nix
sudo /opt/hapee-3.0/sbin/hapee-lb -c -f /etc/hapee-3.0/hapee-lb.cfg
About the configuration validation 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.
Optional: Split the load balancer configuration file Jump to heading
By default, the HAProxy Enterprise service loads only one configuration file, /etc/hapee-<VERSION>/hapee-lb.cfg
. If you have a complex configuration and edit it yourself, you may want to consider splitting the configuration into multiple configuration files.
Info
You cannot split a configuration into multiple files if you use the Data Plane API to make configuration changes. The Data Plane API operates only on single-file configurations.
A multi-file configuration is typically used for load balancers that support multiple applications. In such a configuration, the default configuration file would contain the global
directives shared by all applications, and the defaults
, frontend
, and backend
sections for each application would be contained in their own configuration files. Thus, for example, if there were two applications, there might 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.
To split the load balancer configuration:
-
Create the directory
/etc/hapee-<VERSION>/lb-conf.d
. For example:nixsudo mkdir /etc/hapee-3.0/lb-conf.d/nixsudo mkdir /etc/hapee-3.0/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.
Info
- Do not split configuration sections. A configuration section (such as
global
,defaults
,frontend
, orbackend
) must be completely contained in a single file and cannot be split across multiple files. - Configuration files must have the suffix
.cfg
. - The lexical sort order of the names determines the order in which they are loaded at start time.
- Do not split configuration sections. A configuration section (such as
-
Edit the service environment file:
- On Debian/Ubuntu:
/etc/default/hapee-<VERSION>-lb
- On other operating systems:
/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-3.0-lbtextOPTIONS="-f /etc/hapee-3.0/lb-conf.d/"hapee-3.0-lbtextOPTIONS="-f /etc/hapee-3.0/lb-conf.d/" - On Debian/Ubuntu:
-
Restart the service:
nixsudo systemctl restart hapee-3.0-lbnixsudo systemctl restart hapee-3.0-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 in configurations split as described above.nixsudo /opt/hapee-3.0/sbin/hapee-lb -c -f /etc/hapee-3.0/hapee-lb.cfg -f /etc/hapee-3.0/lb-conf.d/nixsudo /opt/hapee-3.0/sbin/hapee-lb -c -f /etc/hapee-3.0/hapee-lb.cfg -f /etc/hapee-3.0/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?