Start nginx with all servers weighted=0
Vladimir Homutov
vl at nginx.com
Wed Dec 19 20:18:25 UTC 2018
On 19.12.2018 22:47, Pablo Fischer wrote:
> Hi all,
>
> Sorry for posting to nginx-devel but looking to see if I'm missing any
> details. I'm building a service discovery integration on top of our
> Nginx, things work fine but there are two caveats:
>
> - Nginx does not allow you to start with an empty upstream (aka no hosts).
the reason is that such configuration is meaningless,
at least with unmodified nginx version
> - Nginx errors out with invalid configuration if you set a weight to "0".
to disable a particular server, use 'down' flag.
> I'm wondering if there is any technical reason of why I _should not_
> make a patch that would allow the weight to be 0 during startup
> configuration (or reload), looking specifically at this:
>
>
https://github.com/nginx/nginx/blob/cb4dd56771c1af082bf3e810436712b4f48f2cf2/src/http/ngx_http_upstream.c#L5839
>
> or... if there is a known patch that does this already then even better
>
> We have a module that allows us set the weights dynamically via a URL
> we have without reloading nginx (we can't execute continuous reloads
> since our buffers are maxed out so this could potentially throw the
> host into a OOM case).
you may be interested in functionality, available in commercial version,
see http://nginx.org/en/docs/http/ngx_http_upstream_module.html#zone
More information about the nginx-devel
mailing list