Reference
del map
Delete a single entry from 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 del map
to remove a single entry from a Map file. Note that this only removes it from the load balancer’s runtime memory and not from the file on disk.
Map files can also be virtual or optional. If you’re using a virtual Map file, prefix the filename with virt@
when calling del map
. If the file is optional, then don’t specify a prefix.
Examples Jump to heading
Delete a map entry Jump to heading
In this example, we remove the entry that has the key /support/
:
nix
echo "del map /etc/hapee-3.0/hosts.map /support/" | \sudo socat stdio tcp4-connect:127.0.0.1:9999
nix
echo "del map /etc/hapee-3.0/hosts.map /support/" | \sudo socat stdio tcp4-connect:127.0.0.1:9999
Delete a map entry in a transaction Jump to heading
Available since
- HAProxy 2.4
- HAProxy Enterprise 2.4r1
Multiple map file changes can be submitted atomically using the transaction feature. Use prepare map
to start a transaction and commit map
to apply the transaction.
The prepare map
command returns a temporary map file version ID. Specify this ID using the “at” (@
) symbol before the map ID.
-
Use the
show maps
command to list map files and their unique IDs.nixecho "show map" | \sudo socat stdio tcp4-connect:127.0.0.1:9999nixecho "show map" | \sudo socat stdio tcp4-connect:127.0.0.1:9999outputtext# id (file) description0 (/etc/hapee-3.0/routes.map) pattern loaded from file '/etc/hapee-3.0/routes.map' used by map at file '/etc/hapee-3.0/hapee-lb.cfg' line 61. curr_ver=0 next_ver=1 entry_cnt=0outputtext# id (file) description0 (/etc/hapee-3.0/routes.map) pattern loaded from file '/etc/hapee-3.0/routes.map' used by map at file '/etc/hapee-3.0/hapee-lb.cfg' line 61. curr_ver=0 next_ver=1 entry_cnt=0 -
Pass the map file’s unique ID to
show map
to display entries in the file:nixecho "show map #0" | \sudo socat stdio tcp4-connect:127.0.0.1:9999nixecho "show map #0" | \sudo socat stdio tcp4-connect:127.0.0.1:9999outputtext0x563bbeeee160 /cart/ cart_api0x563bbeeee1a0 /reviews/ reviews_api0x563bbeeee1f0 /support/ support_apioutputtext0x563bbeeee160 /cart/ cart_api0x563bbeeee1a0 /reviews/ reviews_api0x563bbeeee1f0 /support/ support_api -
Use
prepare map
to start a transaction.nixecho "prepare map #0" | \sudo socat stdio tcp4-connect:127.0.0.1:9999nixecho "prepare map #0" | \sudo socat stdio tcp4-connect:127.0.0.1:9999outputtextNew version created: 1outputtextNew version created: 1 -
Delete the key
/support/
from the temporary transaction file.nixecho "del map @1 #0 /support/" | \sudo socat stdio tcp4-connect:127.0.0.1:9999nixecho "del map @1 #0 /support/" | \sudo socat stdio tcp4-connect:127.0.0.1:9999 -
Use
commit map
to apply the transaction.nixecho "commit map @1 #0" | \sudo socat stdio tcp4-connect:127.0.0.1:9999nixecho "commit map @1 #0" | \sudo socat stdio tcp4-connect:127.0.0.1:9999
See also Jump to heading
Do you have any suggestions on how we can improve the content of this page?