hapc(1)
π hapc β administrative commands for your haproxy service π
okay bestie, welcome to hapc(1), straight outta the General Commands Manual section. this is the page for hapc, and honestly? it's giving "small tool, big power". let's get into it π
β¨ NAME β¨
hapc β administrative commands for your haproxy service
like. that's the whole vibe. it's the admin-bestie for your haproxy. π«Ά
π¦ SYNOPSIS π¦
hapc <action> [options] [arguments]
that's it. that's the shape of it. you pick an action, you sprinkle on some options, you hand it the arguments, and hapc does the thing. iconic behaviour, no notes. β¨
π DESCRIPTION π
so what does hapc actually do? it configures the backends of an haproxy setup, which means you can put backend servers into maintenance gracefully. no drama, no dropped connections, no 3am panic. it's the "hey bestie, take a little break" of load balancing. π
πΈ OPTIONS πΈ
-verbose|-vβ Display with a more verbose output. she's chatty. she's telling you everything. lowkey obsessed with the details fr fr.
π ACTIONS π
list-backends[-l|--links]β List all available backends, asking through the haproxy socket file. (yes, she asks. through the socket. polite queen.) πlist-frontendsβ List all available frontend as configured in thehaproxy.cfgfile.list-config-backendsβ List all available backends as configured in thehaproxy.cfgfile.list-servers[-b|--backend] <backend>[-d|--details]β List all available servers for a given backend. With--details, the command shows the state of the servers (if they are active in the backend or not). so you can vibe check each server individually πlist-connections[-b|--backend] <backend>[-s|--server] <server>β Show the number of connections for a given backend and server. the receipts. the numbers. the truth. πenable-server[-b|--backend] <backend>[-s|--server] <server>β Set a server asACTIVEin its backend. welcome back to the main character slot bestie π«Άdrain-server[-b|--backend] <backend>[-s|--server] <server>[-w|--wait]β Gracefuly drain a server from its backend. If the--waitoption is added, thenhapcwaits for all connections to be closed before returning, with a timeout set to 60 seconds. so she'll wait for you, but only for a minute. set a boundary, queen. β³stop-server[-b|--backend] <backend>[-s|--server] <server>β Forceably remove a server from its backend, eventually killing existing connections.
π¨ okay so this one is the no-mercy one. it forceably removes the server and it eventually kills existing connections. if you wanted gentle, that was drain-server. this is the "we're done here" button. π
check-safe-to-remove[-b|--backend] <backend>[-s|--server] <server>β Check if a server is safe to remove from its backend (ie: check if there's not existing connections to it). the little pre-flight check before you do something you can't undo. bless. πreload-haproxyβ Reload haproxy. that's it. that's the action. reload. haproxy. π₯
π§ DESCRIPTION π§
(yes, again β she's thorough, we love her for it β¨)
hapc needs an admin socket to be able to use it. So it is needed to add this to /etc/haproxy/haproxy.cfg:
global
stats socket /var/lib/haproxy/admin.sock mode 600 level admin
π no admin socket = no hapc. it's the whole entire prerequisite. put it in the config, or the tool is just gonna sit there looking at you. π₯²
π LICENSE π
This is released under the Apache-2.0 license.
π AUTHORS π
This utility has been written by Olivier Chaze <olivier.chaze at infomaniak dot com> and Thomas Goirand <zigo at debian dot org> for internal use in the Infomaniak servers.
and that's a wrap on the hapc(1) page from the General Commands Manual section, bestie π go forth, drain those servers gracefully, and remember: --wait has a 60 second timeout, so don't leave her hanging. byeeeee π¦β¨π
π¦ where this page comes from
- debian trixie: haproxy-cmd 0.0.7 Β· Apache-2
- ubuntu resolute: haproxy-cmd 0.0.7 Β· Apache-2
- ubuntu stonking: haproxy-cmd 0.0.7build1 Β· Apache-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms