Reference

add map

Add an entry to a Map file.

Description Jump to heading

A Map file contains a list of key-value pairs. You can reference the file on an acl line by using the -M and -f /path/to/file flags. Use add map to add a new entry to a Map file. Note that this only adds it to the load balancer’s runtime memory and not to the file on disk.

Examples Jump to heading

In this example, the key foo.example.com and value be_bar are added as a new line in the file /etc/hapee-2.8/maps/hosts.map.

bash
echo "add map /etc/hapee-2.8/maps/hosts.map foo.example.com be_bar" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999
bash
echo "add map /etc/hapee-2.8/maps/hosts.map foo.example.com be_bar" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999

Available since

  • HAProxy 2.4
  • HAProxy Enterprise 2.4r1

In this example, the key foo.example.com is modified in version 3, an uncommitted temporary file, of the map file indicated by ID 2:

bash
echo "add map @3 #2 foo.example.com be_bar" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999
bash
echo "add map @3 #2 foo.example.com be_bar" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999

See also Jump to heading

If this page was useful, please, Leave the feedback.