another dynamic server. This is to ensure that the tracking chain is kept
consistent even in the case of dynamic servers deletion.
+ Use the "check" keyword to enable health-check support. Note that the
+ health-check is disabled by default and must be enabled independently from
+ the server using the "enable health" command.
+
Here is the list of the currently supported keywords :
- allow-0rtt
- alpn
+ - addr
- backup
- ca-file
+ - check
+ - check-proto
+ - check-send-proxy
+ - check-via-socks4
- ciphers
- ciphersuites
- crl-file
- crt
- disabled
+ - downinter
- enabled
+ - fall
+ - fastinter
- force-sslv3/tlsv10/tlsv11/tlsv12/tlsv13
- id
+ - inter
- maxconn
- maxqueue
- minconn
- pool-low-conn
- pool-max-conn
- pool-purge-delay
+ - port
- proto
- proxy-v2-options
+ - rise
- send-proxy
- send-proxy-v2
- send-proxy-v2-ssl
{ "agent-inter", srv_parse_agent_inter, 1, 1, 1 }, /* Set the interval between two agent checks */
{ "agent-port", srv_parse_agent_port, 1, 1, 1 }, /* Set the TCP port used for agent checks. */
{ "agent-send", srv_parse_agent_send, 1, 1, 1 }, /* Set string to send to agent. */
- { "check", srv_parse_check, 0, 1, 0 }, /* Enable health checks */
+ { "check", srv_parse_check, 0, 1, 1 }, /* Enable health checks */
{ "check-proto", srv_parse_check_proto, 1, 1, 1 }, /* Set the mux protocol for health checks */
{ "check-send-proxy", srv_parse_check_send_proxy, 0, 1, 1 }, /* Enable PROXY protocol for health checks */
{ "check-via-socks4", srv_parse_check_via_socks4, 0, 1, 1 }, /* Enable socks4 proxy for health checks */
goto out;
}
+ /* Init check if configured. The check is manually disabled because a
+ * dynamic server is started in a disable state. It must be manually
+ * activated via a "enable health" command.
+ */
+ if (srv->do_check) {
+ if (init_srv_check(srv))
+ goto out;
+
+ srv->check.state &= ~CHK_ST_ENABLED;
+ srv_use_dynsrv(srv);
+ }
+
/* Attach the server to the end of the proxy linked list. Note that this
* operation is not thread-safe so this is executed under thread
* isolation.
srv_use_dynsrv(srv);
thread_release();
+ /* Start the check task. The server must be fully initialized.
+ *
+ * <srvpos> and <nbcheck> parameters are set to 1 as there should be no
+ * need to randomly spread the task interval for dynamic servers.
+ */
+ if (srv->check.state & CHK_ST_CONFIGURED) {
+ if (!start_check_task(&srv->check, 0, 1, 1))
+ ha_alert("System might be unstable, consider to execute a reload");
+ }
+
ha_notice("New server registered.\n");
cli_msg(appctx, LOG_INFO, usermsgs_str());
if (srv->track)
release_server_track(srv);
+ if (srv->check.state & CHK_ST_CONFIGURED)
+ free_check(&srv->check);
+
/* remove the server from the proxy linked list */
if (be->srv == srv) {
be->srv = srv->next;
if (srv->track)
release_server_track(srv);
- /* TODO remove server for check list once 'check' will be implemented for
- * dynamic servers
- */
+ /* stop the check task if running */
+ if (srv->check.state & CHK_ST_CONFIGURED)
+ check_purge(&srv->check);
/* detach the server from the proxy linked list
* The proxy servers list is currently not protected by a lock, so this