Upstream block: backup with max_fails=0 does not appear to work as expected

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Upstream block: backup with max_fails=0 does not appear to work as expected

nginx mailing list
Hello,

I have an upstream block with two servers as follows:

upstream {
  server foo.com;
  server bar.com max_fails=0 backup;
}

My desired use case would be that the foo.com server is hit for all requests and can be marked as down by nginx if it starts serving errors. In this case nginx will fallback to hitting bar.com, however bar.com should not be allowed to be marked down by nginx.

What is actually happening is the "max_fails=0" statement is essentially being ignored causing the error message "no live upstreams while connecting to upstream" in my logs.

Is there a configuration here that obtains my desired use case?

Thank you,
~Jonathan

--
Jonathan Simowitz |Jigsaw | Software Engineer | [hidden email] | 
 631-223-8608


_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Upstream block: backup with max_fails=0 does not appear to work as expected

Roman Arutyunyan
Hi Jonathan,

On Wed, May 17, 2017 at 05:05:51PM -0400, Jonathan Simowitz via nginx wrote:

> Hello,
>
> I have an upstream block with two servers as follows:
>
> upstream {
>   server foo.com;
>   server bar.com max_fails=0 backup;
> }
>
> My desired use case would be that the foo.com server is hit for all
> requests and can be marked as down by nginx if it starts serving errors. In
> this case nginx will fallback to hitting bar.com, however bar.com should
> not be allowed to be marked down by nginx.
>
> What is actually happening is the "max_fails=0" statement is essentially
> being ignored causing the error message "no live upstreams while connecting
> to upstream" in my logs.

That's what happens when bar.com is in fact unavailable too.
Even though it's not globally marked as down.

[..]

--
Roman Arutyunyan
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx