<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><pre><div>Thanks for the answer.</div><div><br></div><div>Maybe you miss something in Question 2. The server 192.168.0.5 never fails.</div><div>I think nginx should not return 502 if there is at least one server never fails.</div><div>Exactly speaking, the server never fails in the last 1 hour and the fail_timeout is the default 10 second.</div><div><br></div><div><br></div>>> 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.
>
>See above, this is exactly what is expected to happen when a
>request to upstream server fails. The 502 / "no live upstream"
>you are seeing is a result of all servers considered unavailable.
>There are only few such errors as you are using nginx 1.8.1, which
>quickly resets failure counters of all servers in such situation.
>With recent nginx versions, 502 errors will be returned till
>fail_timeout expiration.
>
>If you want nginx to completely ignore errors on the only working
>upstream server in your environment, consider using "server ...
>max_fails=0". Alternatively, consider using fail_timeout which is
>appropriate for your environment.
>
>--
>Maxim Dounin
>http://nginx.org/
>_______________________________________________
>nginx mailing list
>nginx@nginx.org
>http://mailman.nginx.org/mailman/listinfo/nginx
</pre></div><br><br><span title="neteasefooter"><p> </p></span>