Tutorials
Manage global settings
In your load balancer configuration, a global
section defines settings that affect how the load balancer runs.
You can manage global settings programmatically by calling the API endpoint /services/haproxy/configuration/global
.
Note
The version
parameter in DELETE, POST, and PUT requests must match the system’s current version. The examples in this section use a GET request to /v2/services/haproxy/configuration/version
to retrieve the version and populate the CFGVER
environment variable for the URL version
parameter.
List global settings Jump to heading
To get the contents of a global
section, make a GET request to the global
endpoint:
nix
curl -X GET \--user admin:adminpwd \"http://127.0.0.1:5555/v2/services/haproxy/configuration/global"
nix
curl -X GET \--user admin:adminpwd \"http://127.0.0.1:5555/v2/services/haproxy/configuration/global"
outputjson
{"_version":3,"data":{"cpu_maps":[],"module-loads":[],"runtime_apis":[{"address":"/var/run/hapee-2.8/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.8/hapee-lb.pid","ssl_mode_async":"disabled","user":"hapee-lb"}}
outputjson
{"_version":3,"data":{"cpu_maps":[],"module-loads":[],"runtime_apis":[{"address":"/var/run/hapee-2.8/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.8/hapee-lb.pid","ssl_mode_async":"disabled","user":"hapee-lb"}}
Replace global settings Jump to heading
To make changes to global settings, you must replace them entirely. To replace global settings, make a PUT request to the global
endpoint, passing the fields in the body of the request:
nix
CFGVER=$(curl -s -u admin:adminpwd http://localhost:5555/v2/services/haproxy/configuration/version)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.8/hapee-lb.pid","runtime_apis": [{"address": "/var/run/hapee-2.8/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=$CFGVER"
nix
CFGVER=$(curl -s -u admin:adminpwd http://localhost:5555/v2/services/haproxy/configuration/version)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.8/hapee-lb.pid","runtime_apis": [{"address": "/var/run/hapee-2.8/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=$CFGVER"
Do you have any suggestions on how we can improve the content of this page?