Reference

show map

Use show map to list map files defined in the configuration.

Description Jump to heading

Use the show map command to list map files or to display the contents of a particular map file. The contents of the map may be different from what’s on disk if you’ve used the Runtime API to add or delete entries in memory.

As of version 2.4r1, the show map command shows the following map file version information for each map file:

  • curr_ver indicates the currently active version number of the map file.
  • next_ver indicates the version number of the temporary version (in-progress transaction) of the map file.
  • entry_cnt indicates the number of entries in the temporary transaction version of the map file.

Examples Jump to heading

In the example below, we use show map with no arguments to list the map files registered with the load balancer. The output shows the path to the map files and their numeric IDs:

nix
echo "show map" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999
nix
echo "show map" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999
output
text
# id (file) description
0 (/etc/hapee-2.8/routes.map) pattern loaded from file '/etc/hapee-2.8/routes.map' used by map at file '/etc/hapee-2.8/hapee-lb.cfg' line 61. curr_ver=0 next_ver=2 entry_cnt=2
output
text
# id (file) description
0 (/etc/hapee-2.8/routes.map) pattern loaded from file '/etc/hapee-2.8/routes.map' used by map at file '/etc/hapee-2.8/hapee-lb.cfg' line 61. curr_ver=0 next_ver=2 entry_cnt=2

In this case, there is one map file defined at /etc/hapee-2.8/routes.map and its ID is 0.

  1. Display the contents of the /etc/hapee-2.8/routes.map map file by passing its path to show map:

    nix
    echo "show map /etc/hapee-2.8/routes.map" | \
    sudo socat stdio tcp4-connect:127.0.0.1:9999
    nix
    echo "show map /etc/hapee-2.8/routes.map" | \
    sudo socat stdio tcp4-connect:127.0.0.1:9999
    output
    text
    0x563bbeeee160 /cart/ cart_api
    0x563bbeeee1a0 /reviews/ reviews_api
    0x563bbeeee200 /products/ products_api
    0x563bbeeee280 /login/ login_api
    0x563bbeeee300 /chat/ chat_servers
    output
    text
    0x563bbeeee160 /cart/ cart_api
    0x563bbeeee1a0 /reviews/ reviews_api
    0x563bbeeee200 /products/ products_api
    0x563bbeeee280 /login/ login_api
    0x563bbeeee300 /chat/ chat_servers

    You can also pass it the map’s ID prefixed with a hash sign:

    nix
    echo "show map #0" | \
    sudo socat stdio tcp4-connect:127.0.0.1:9999
    nix
    echo "show map #0" | \
    sudo socat stdio tcp4-connect:127.0.0.1:9999
    output
    text
    0x563bbeeee160 /cart/ cart_api
    0x563bbeeee1a0 /reviews/ reviews_api
    0x563bbeeee200 /products/ products_api
    0x563bbeeee280 /login/ login_api
    0x563bbeeee300 /chat/ chat_servers
    output
    text
    0x563bbeeee160 /cart/ cart_api
    0x563bbeeee1a0 /reviews/ reviews_api
    0x563bbeeee200 /products/ products_api
    0x563bbeeee280 /login/ login_api
    0x563bbeeee300 /chat/ chat_servers

As of version 2.4r1, you can also show the uncommitted changes in the uncommitted version of a map file:

nix
echo "show map @3 #2" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999
nix
echo "show map @3 #2" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999

Version files are uncommitted temporary files used in the transaction feature, which uses the prepare map and commit map commands.

See also Jump to heading

Do you have any suggestions on how we can improve the content of this page?