Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uwsgicluster - no live upstreams while connecting to upstream client

Below simple nginx config for cluster, then I turn off 192.168.1.77:3032 server.

From time to time I catch 502 error and "no live upstreams while connecting to upstream client" in logs, while "server unix:///var/tmp/site.sock backup;" working and as I guess must handle request but nginx don't find it as live. What could be the problem?

nginx config:

       upstream uwsgicluster {
            server 192.168.1.77:3032;
            server unix:///var/tmp/site.sock backup;
        } 


server {
    listen      80;
    server_name site.com www.site.com;
    access_log  /var/log/nginx/sire.log;
    error_log  /var/log/nginx/site-error.log;


    location / {
            uwsgi_pass   uwsgicluster;
            include        uwsgi_params;
        }
}

If I remove 192.168.1.77:3032 server from upstream and restart nginx it works fine, but with switched off 192.168.1.77:3032 server errors occurs periodically

like image 715
Evg Avatar asked Nov 12 '22 18:11

Evg


1 Answers

I think that nginx will still try both of the servers in the upstream block even if one isn't working. When it fails to connect to one of them, it will try the other one, but will still log the error you are seeing.

By default, the proxy_next_upstream setting will try the next upstream server on error or timeout. You can override this:

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_next_upstream

Are you only seeing error logs, or are you also seeing undesired behavior/load-balancing?

like image 89
TheJeff Avatar answered Jan 04 '23 01:01

TheJeff