Приветствую,

http {
    log_format lb
'$remote_addr\t[$time_local]\t$http_x_warehouse_code\t$upstream_addr';

    upstream groups {
        hash $http_x_warehouse_code consistent;
        server 127.0.0.1:8001 max_fails=0;
        server 127.0.0.2:8002 max_fails=0;
        keepalive 1000;
    }

    server {
        listen            80;
        access_log  /var/log/nginx/lb_groups.log  lb;
        access_log  /var/log/nginx/access.log  main;

        location / {
            proxy_pass  http://groups;
            proxy_http_version 1.1;
            #proxy_next_upstream error timeout http_502;
            proxy_next_upstream off;
        }
    }
}

При этом

# grep , lb_groups.log
10.98.26.35    [25/Dec/2015:17:40:01 +0300]    552277    127.0.0.2:8002,
127.0.0.1:8001, 127.0.0.1:8001
10.98.21.188    [25/Dec/2015:17:41:28 +0300]    543382    127.0.0.1:8001,
127.0.0.2:8002
10.98.65.252    [25/Dec/2015:17:47:06 +0300]    210024    127.0.0.2:8002,
127.0.0.1:8001
10.98.10.65    [25/Dec/2015:17:47:06 +0300]    703024    127.0.0.2:8002,
127.0.0.1:8001
10.98.45.143    [25/Dec/2015:17:47:25 +0300]    020122    127.0.0.1:8001,
127.0.0.2:8002

Вопросы:
1. Почему переключение на следующий апстрим происходит, т.е. почему nginx
игнорирует proxy_next_upstream и max_fails=0?
2. Как объяснить nginx'у, что так делать не следует?

-- 
Kind regards,
Vladimir.
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru

Ответить