diff options
| author | Ruslan Ermilov <ru@nginx.com> | 2014-02-15 15:12:34 +0400 |
|---|---|---|
| committer | Aleksei Bavshin <a.bavshin@f5.com> | 2024-11-07 07:57:42 -0800 |
| commit | db6870e06dde7ab249e9a41a0e0a76219f82dd8c (patch) | |
| tree | d24f1bb15d855a4a85f1240cc4bbbc9dbf6f74be /src/http/ngx_http_upstream.h | |
| parent | ebd18ec1812bd6f3de54d9f9fc81563a0ec9f264 (diff) | |
| download | nginx-db6870e06dde7ab249e9a41a0e0a76219f82dd8c.tar.gz nginx-db6870e06dde7ab249e9a41a0e0a76219f82dd8c.tar.bz2 | |
Upstream: re-resolvable servers.
Specifying the upstream server by a hostname together with the
"resolve" parameter will make the hostname to be periodically
resolved, and upstream servers added/removed as necessary.
This requires a "resolver" at the "http" configuration block.
The "resolver_timeout" parameter also affects when the failed
DNS requests will be attempted again. Responses with NXDOMAIN
will be attempted again in 10 seconds.
Upstream has a configuration generation number that is incremented each
time servers are added/removed to the primary/backup list. This number
is remembered by the peer.init method, and if peer.get detects a change
in configuration, it returns NGX_BUSY.
Each server has a reference counter. It is incremented by peer.get and
decremented by peer.free. When a server is removed, it is removed from
the list of servers and is marked as "zombie". The memory allocated by
a zombie peer is freed only when its reference count becomes zero.
Co-authored-by: Roman Arutyunyan <arut@nginx.com>
Co-authored-by: Sergey Kandaurov <pluknet@nginx.com>
Co-authored-by: Vladimir Homutov <vl@nginx.com>
Diffstat (limited to 'src/http/ngx_http_upstream.h')
| -rw-r--r-- | src/http/ngx_http_upstream.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/http/ngx_http_upstream.h b/src/http/ngx_http_upstream.h index db0e1424e..0922021bd 100644 --- a/src/http/ngx_http_upstream.h +++ b/src/http/ngx_http_upstream.h @@ -104,7 +104,11 @@ typedef struct { unsigned backup:1; - NGX_COMPAT_BEGIN(6) +#if (NGX_HTTP_UPSTREAM_ZONE) + ngx_str_t host; +#endif + + NGX_COMPAT_BEGIN(4) NGX_COMPAT_END } ngx_http_upstream_server_t; @@ -115,6 +119,7 @@ typedef struct { #define NGX_HTTP_UPSTREAM_FAIL_TIMEOUT 0x0008 #define NGX_HTTP_UPSTREAM_DOWN 0x0010 #define NGX_HTTP_UPSTREAM_BACKUP 0x0020 +#define NGX_HTTP_UPSTREAM_MODIFY 0x0040 #define NGX_HTTP_UPSTREAM_MAX_CONNS 0x0100 @@ -133,6 +138,8 @@ struct ngx_http_upstream_srv_conf_s { #if (NGX_HTTP_UPSTREAM_ZONE) ngx_shm_zone_t *shm_zone; + ngx_resolver_t *resolver; + ngx_msec_t resolver_timeout; #endif }; |
