Welcome! Log In Create A New Profile

Advanced

proxy_upstream_next while no live upstreams

Wu Bingzheng
May 10, 2017 04:28AM
Hi all,

I have an upstream configure with Nginx 1.8.1 :

upstream test {
server 192.168.0.5;
server 192.168.0.6;
}

Question 1:
Assume both of the 2 servers are down.
First request tries both of them and fails, and response 502. Nginx marks both of them as DOWN. This is OK.
Second request comes and finds there is no live upstreams, then Nginx resets both of servers as UP, logs "no live upstreams", and returns 502.
My question is that in the second request, nginx dose NOT try the 2 servers, but just return 502 immediately. Is this in line with expectations?

From the code in ngx_http_upstream_next(), ft_type=NGX_HTTP_UPSTREAM_FT_NOLIVE always leads to ngx_http_upstream_finalize_request() while not ngx_http_upstream_connect().


Question 2: (not related with Question 1)
In my production environment, 192.168.0.5 is UP, and 192.168.0.6 is DOWN.
There are few access logs with $upstream_addr as "192.168.0.6, test", and $status as 502.
There were no error logs of connecting/reading 192.168.0.5 fails which mean this server is UP, so I think the request should try 192.168.0.5 after 192.168.0.6.
But it does not try 192.168.0.5, and just log "no live upstream" and return 502.
The logs like this are very few, and I can not re-produce this or debug it.
I just ask it here in case someone else know the problem.


Thanks in advance,
Wu
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

proxy_upstream_next while no live upstreams

Wu Bingzheng May 10, 2017 04:28AM

Re: proxy_upstream_next while no live upstreams

Maxim Dounin May 10, 2017 08:46AM

Re:Re: proxy_upstream_next while no live upstreams

Wu Bingzheng May 10, 2017 10:30AM

Re: Re: proxy_upstream_next while no live upstreams

Maxim Dounin May 10, 2017 10:44AM

Re:Re: Re: proxy_upstream_next while no live upstreams

Wu Bingzheng May 12, 2017 01:36AM

Re: Re: Re: proxy_upstream_next while no live upstreams

Maxim Dounin May 12, 2017 06:40AM

Re:Re: Re: Re: proxy_upstream_next while no live upstreams

Wu Bingzheng May 13, 2017 12:42AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 319
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready