combine_server_singlets

The combine_server_singlets directive creates multiple singlet upstreams from defined servers within a host upstream.

Syntaxcombine_server_singlets;
Defaultnone
Contextupstream
Argumentsnone

Description

The combine_server_singlets directive is designed to produce multiple singlet upstream configurations from servers defined in a host upstream block. A singlet upstream contains exactly one active server, while the remaining servers can be designated as backups or marked as down based on the configuration provided. By default, if no additional parameters are specified, the singlet upstreams are named according to the original host upstream name, followed by an ordering number that represents the index of the active server.

This directive supports optional parameters to customize the naming of the singlet upstreams. The first optional parameter is a suffix that you can append to the host upstream name, while the second optional parameter allows you to set the zero-padding for the ordering number, ensuring that the numbers align correctly (for example, '01', '02', ...). In addition, users can specify an optional "nobackup" parameter at the end to mark secondary servers as down instead of backup, adjusting the behavior of how these servers are treated in failover scenarios.

Config Example

upstream my_upstream {
    server s1;
    server s2;
    server s3;
    combine_server_singlets;
}

Not using parameters will result in default naming, which may not be intuitive.

If the optional 'nobackup' parameter is included, ensure it is placed at the end to avoid configuration errors.

← Back to all directives