Reference

del server

Available since

  • HAProxy 2.4
  • HAProxy Enterprise 2.4r1

Remove a dynamic server from a backend.

Description Jump to heading

Remove a dynamic server attached to a backend. This operation is valid only for dynamic servers, those added using the Runtime API add server command. For versions 2.4r1 and 2.5r1, this operation is supported only on a CLI connection running in experimental mode (experimental-mode on).

A server is considered removable if it satisfies all of these conditions:

  • It’s not referenced by other configuration elements.
  • It must already be in maintenance (see disable server).
  • It can’t have any active or idle connections.

If any of these conditions isn’t met, the command fails.

Active connections are those with at least one ongoing request. It’s possible to speed up their termination using shutdown sessions server. It’s highly recommended to use wait srv-removable before del server to ensure that all active or idle connections are closed and that the command succeeds.

Examples Jump to heading

Below, we delete the server server2 from backend be_test.

First place the server in maintenance mode. As an alternative to the set server command, you could use the disable server command.

nix
echo "set server be_test/server2 state maint" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999
nix
echo "set server be_test/server2 state maint" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999

Delete the server.

nix
echo "del server be_test/server2" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999
nix
echo "del server be_test/server2" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999

For versions 2.4r1 and 2.5r1, experimental-mode must be on.

nix
echo "experimental-mode on; del server be_test/server2" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999
nix
echo "experimental-mode on; del server be_test/server2" | \
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?