Example :
default-server inter 1000 weight 13
+ Multiple default-server lines can be specified in the same backend with each
+ new line completing the previous one. This set of options can be reset by
+ using the "from none" keyword value.
+
+ A default-server with no parameter set will automatically be purged after
+ parsing. As such, a final "default-server from none" statement will be
+ sufficient to release this unused memory.
+
See also: "server" and section 5 about server options
from <origin>
Preinitialize the server settings by copying values from another server or
- default-server instance.
+ default-server instance. This keyword is positional : it must be specified
+ before any other server settings.
Here is the list of the supported values for the "from" keyword :
+ - none
+ resets all settings to the documented defaults. This prevents a server
+ defined in the configuration from automatically reusing a default-server
+ instance. This is already the default behavior for dynamically created
+ servers. This value is also directly useful on a default-server line,
+ to reset its set of options to their documented values, before eventually
+ configuring new settings.
The currently supported server settings are the following ones. Note that all
these settings are supported both by "server" and "default-server" keywords,
default-server inter 5s
server srvconf1 ${s1_addr}:${s1_port}
+ server srvconf2 ${s1_addr}:${s1_port} from none
+
+ # reset the default-server
+ default-server from none
+ server srvconf3 ${s1_addr}:${s1_port}
+
+ # configure new default-server settings used for dynamic servers
+ default-server weight 10
} -start
haproxy h1 -cli {
# static server uses by default the default-server
send "get weight be/srvconf1"
expect ~ "10 \\(initial 10\\)"
+
+ # from none keyword
+ send "get weight be/srvconf2"
+ expect ~ "1 \\(initial 1\\)"
+
+ # check from none on default-server
+ send "get weight be/srvconf3"
+ expect ~ "1 \\(initial 1\\)"
}
# dynamic servers
err_code |= ERR_FATAL | ERR_ALERT;
goto out;
}
+ else if (strcmp(args[*cur_arg + 1], "none") == 0) {
+ *from = NULL;
+ }
else {
ha_alert("invalid '%s' value for 'from' keyword.\n", args[*cur_arg + 1]);
err_code |= ERR_FATAL | ERR_ALERT;