add server

Available since

  • HAProxy 2.4
  • HAProxy Enterprise 2.4r1

Add a dynamic server to a backend.

Description Jump to heading

Instantiate a new server attached to an existing backend. Such a server may also be called a dynamic server.

The specified server name must not already be in use in the backend. The backend must be configured to use a dynamic load-balancing algorithm for the balance directive: roundrobin, leastconn, first, or random.

A dynamic server is not restored after a proxy reload operation. If you need the server definition to persist, add it to the load balancer’s configuration file.

Dynamic servers are statically initialized with the none init-addr method. In this method, the server starts in the down state without a valid IP address.

It may be possible to reach the fd (file descriptor) limit when using a large number of dynamic servers. See also fd-hard-limit and ulimit-n in the global keyword documentation.

The following keywords are supported for configuring the new server:

Keyword Note Available since version
agent-addr 2.5r1
agent-check Even when enabled by this keyword, agent check is still inactive until activated independently of the server with the enable agent command. Note that in this case the server may be activated via the agent depending on the status reported, without an explicit enable server command. This also means that extra care is required when removing a dynamic server with agent check. The agent should first be deactivated using disable agent to be able to put the server in the required maintenance mode before removal. 2.5r1
agent-inter 2.5r1
agent-port 2.5r1
agent-send 2.5r1
allow-0rtt 2.5r1
alpn 2.5r1
addr 2.5r1
backup 2.4r1
ca-file 2.5r1
check Even when enabled by this keyword, health check is still inactive until activated independently of the server with the enable health command. 2.5r1
check-alpn 2.5r1
check-proto 2.5r1
check-send-proxy 2.5r1
check-sni 2.5r1
check-ssl 2.5r1
check-via-socks4 2.5r1
ciphers 2.5r1
ciphersuites 2.5r1
crl-file 2.5r1
crt 2.5r1
disabled 2.4r1
downinter 2.5r1
enabled 2.4r1
error-limit 2.5r1
fall 2.5r1
fastinter 2.5r1
force-sslv3/tlsv10/tlsv11/tlsv12/tlsv13 2.5r1
id 2.4r1
inter 2.5r1
maxconn 2.4r1
maxqueue 2.4r1
minconn 2.4r1
no-ssl-reuse 2.5r1
no-sslv3/tlsv10/tlsv11/tlsv12/tlsv13 2.5r1
no-tls-tickets 2.5r1
npn 2.5r1
observe 2.5r1
on-error 2.5r1
on-marked-down 2.5r1
on-marked-up 2.5r1
pool-low-conn 2.4r1
pool-max-conn 2.4r1
pool-purge-delay 2.4r1
port 2.5r1
proto 2.4r1
proxy-v2-options 2.4r1
rise 2.5r1
send-proxy 2.4r1
send-proxy-v2 2.4r1
send-proxy-v2-ssl 2.5r1
send-proxy-v2-ssl-cn 2.5r1
slowstart 2.5r1
sni 2.5r1
source 2.4r1
ssl 2.5r1
ssl-max-ver 2.5r1
ssl-min-ver 2.5r1
tfo 2.4r1
tls-tickets 2.5r1
track A dynamic server may use this keyword to follow the check status of another server from the configuration. However, it is not possible to track another dynamic server. This restriction ensures that the tracking chain is kept consistent in the event a dynamic server is deleted. 2.5r1
usesrc 2.4r1
verify 2.5r1
verifyhost 2.5r1
weight 2.4r1
Ws 2.5r1

Settings from the default-server statement, if any, in the backend configuration are not applied to the new server.

Servers added with this command can be deleted using the del server command.

Examples Jump to heading

Below, we add the server server2 to backend be_test:

echo "add server be_test/server2 enabled maxconn=1000" | \
sudo socat stdio tcp4-connect:
echo "add server be_test/server2 enabled maxconn=1000" | \
sudo socat stdio tcp4-connect:

See also Jump to heading

If this page was useful, please, Leave the feedback.

© 2023 HAProxy Technologies, LLC. All Rights Reserved
Manage Cookie Preferences