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.
+ - be:[<bename>]
+ instructs to reuse the settings from the final state of the designated
+ backend's default-server resulting from the processing of all its unnamed
+ default-server directives. If no backend is specified, the parent proxy
+ of the currently configured server is selected : this is the default
+ behavior for servers defined in the configuration file. This empty value
+ is mostly useful for dynamic servers created on the CLI which by default
+ ignore any default-server, which is equivalent to the "none" value.
The currently supported server settings are the following ones. Note that all
these settings are supported both by "server" and "default-server" keywords,
restriction is put on the backend which must used a dynamic load-balancing
algorithm. A subset of keywords from the server config file statement can be
used to configure the server behavior (see "add server help" to list them).
- Also note that no settings will be reused from an hypothetical
- 'default-server' statement in the same backend.
+
+ By default, 'default-server' is ignored by a dynamically created server.
+ However, it is possible to use the 'from' server positional keyword to
+ explicitely preset the settings of the newly created server from a
+ default-server instance.
Currently a dynamic server is statically initialized with the "none"
init-addr method. This means that no resolution will be undertaken if a FQDN
expect ~ "New server registered."
send "get weight be/srvdyn1"
expect ~ "1 \\(initial 1\\)"
+
+ # reuse default-server for a dynamic server insertion
+ send "add server be/srvdyn2 ${s1_addr}:${s1_port} from be:"
+ expect ~ "New server registered."
+ send "get weight be/srvdyn2"
+ expect ~ "10 \\(initial 10\\)"
}
else if (strcmp(args[*cur_arg + 1], "none") == 0) {
*from = NULL;
}
+ else if (strncmp(args[*cur_arg + 1], "be:", 3) == 0) {
+ struct ist be_name = istadv(ist(args[*cur_arg + 1]), 3);
+ struct proxy *px = curproxy;
+
+ if (istlen(be_name)) {
+ px = proxy_be_by_name(istptr(be_name));
+ if (!px) {
+ ha_alert("from: unknown backend instance '%s'.\n",
+ istptr(be_name));
+ err_code = ERR_ALERT | ERR_FATAL;
+ goto out;
+ }
+ }
+
+ *from = px->defsrv;
+ }
else {
ha_alert("invalid '%s' value for 'from' keyword.\n", args[*cur_arg + 1]);
err_code |= ERR_FATAL | ERR_ALERT;