Reference
commit map
Available since
- HAProxy 2.4
- HAProxy Enterprise 2.4r1
Commit a transaction of map file changes.
Description Jump to heading
Commit a transaction of map file changes. A transaction is initiated by executing the prepare map
operation, which creates a new version of the map file. The version number is displayed as next_ver
by the show map
command. By specifying the version number and map ID or file name, you can make changes to the temporary map version using operations such as add map
and clear map
.
Committing the transaction makes the changes active in runtime memory and deletes all past versions of the map file in runtime memory. The operation is atomic. All changes represented in the transaction are applied together instantly, and any previous versions of the map are deleted from memory.
If no changes were made to the map version since the prepare map
operation, performing the commit map
operation effectively clears the map in runtime memory.
There is no abort map
command. To abandon a transaction, simply do not commit it. Any uncommitted transaction is removed the next time you execute the prepare map
command.
Examples Jump to heading
-
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_apioutputtext0x563bbeeee160 /cart/ cart_api0x563bbeeee1a0 /reviews/ reviews_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 all keys and values from the temporary transaction file.
nixecho "clear map @1 #0" | \sudo socat stdio tcp4-connect:127.0.0.1:9999nixecho "clear map @1 #0" | \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?