HAProxy Enterprise Documentation 2.4r1

Global

The global section appears at the top of your configuration file. It defines process-level directives such as the maximum number of connections to accept, where to forward logs, and the path from which to load HAProxy Enterprise modules.

global
   # Bind the Runtime API to a UNIX domain socket and/or an IP address
   stats socket /var/run/hapee-2.4/hapee-lb.sock user hapee-lb group hapee mode 660 level admin
   stats socket ipv4@*:9024 level admin

   # Set a timeout for how long you can stay connected to the Runtime API,
   # which is useful for longer interactive terminal sessions
   stats timeout 10m

   # Set remote or local Syslog server addresses to send log files to
   log 127.0.0.1 local0
   log 127.0.0.1 local1 notice

   # Set the user and group to run HAProxy Enterprise as
   user  hapee-lb
   group hapee

   # Run the process in a chrooted directory
   chroot /var/empty

   # Set the path from which to load Enterprise modules
   module-path /opt/hapee-2.4/modules

Data Plane API

You can manage the global section of your configuration remotely by calling the Data Plane API endpoint /services/haproxy/configuration/global.

  1. Install the Data Plane API.

  2. Get the contents of a global section with the GET method:

    $ curl -X GET \
        --user admin:adminpwd \
        "http://127.0.0.1:5555/v2/services/haproxy/configuration/global"
    
    # output
    {
       "_version":3,
       "data":
         {
            "cpu_maps":[],
            "module-loads":[],
            "runtime_apis":[{
                "address":"/var/run/hapee-2.4/api.sock",
                "level":"admin",
                "mode":"660"
             },
             {
                "address":"ipv4@0.0.0.0:9000",
                "level":"admin"
             }],
             "chroot":"/var/empty",
             "daemon":"disabled",
             "group":"hapee",
             "log_send_hostname": { "enabled":"disabled" },
             "lua_loads":[],
             "maxconn":100000,
             "pidfile":"/var/run/hapee-2.4/hapee-lb.pid",
             "ssl_mode_async":"disabled",
             "user":"hapee-lb"
          }
    }
  3. Replace the contents of a global section with the PUT method:

    $ curl -X PUT \
        --user admin:adminpwd \
        -H "Content-Type: application/json" \
        -d '{
            "maxconn": 100000,
            "chroot": "/var/empty",
            "user": "hapee-lb",
            "group": "hapee",
            "pidfile": "/var/run/hapee-2.4/hapee-lb.pid",
            "runtime_apis": [{
                "address": "/var/run/hapee-2.4/api.sock",
                "exposeFdListeners": false,
                "level": "admin",
                "mode": "660"
            },
            {
                "address": "ipv4@0.0.0.0:9000",
                "exposeFdListeners": false,
                "level": "admin"
            }]
        }' \
        "http://127.0.0.1:5555/v2/services/haproxy/configuration/global?version=1"

Next up

Frontend
HAProxyConf 2022 - Call for papers