Доброго дня!
 
Решили попробовать nginx plus и модуль healt_heck.
 
Собственно отрывок из конфига:
 
match backend {
  status 200-403;
}
 
upstream backend {
  zone upstream_backend 64k;
  queue 1024;
 
  server .... slow_start=60s max_cons=1024;
 
  least_conn;
}
 
server {
  listen 80;
 
  location / {
    health_check match=backend;
    proxy_pass http://backend;
 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_connect_timeout 1s;
    proxy_next_upstream error timeout invalid_header;
 
    proxy_http_version 1.1;
    proxy_set_header Connection "";
    proxy_buffers 4 256k;
  }
 
 location = /status {
    stub_status on;
    access_log off;
  }
 
  location = /status.json {
    status;
  }
 
  location /upstream_conf {
    upstream_conf;
  }
 
}
 
Есть часть бэкендов которые в данный момент выключены физически, но они прописаны в upstream backend. При этом запросы на эти бэкенды продолжают сыпаться, а health_check не отправляет health requests на бэкенды, о чем можно догадаться прочитав статус:
 
            {
                "active": 0,
                "backup": false,
                "downstart": 1407244491219,
                "downtime": 515646,
                "fails": 78,
                "health_checks": {
                    "checks": 0,
                    "fails": 0,
                    "unhealthy": 0
                },
                "id": 28,
                "keepalive": 0,
                "max_conns": 1024,
                "received": 0,
                "requests": 78,
                "responses": {
                    "1xx": 0,
                    "2xx": 0,
                    "3xx": 0,
                    "4xx": 0,
                    "5xx": 0,
                    "total": 0
                },
                "sent": 0,
                "server": "....:80",
                "state": "unavail",
                "unavail": 1,
                "weight": 1
            }
 
root@<hostname>:/etc/nginx# uname -a
Linux <hostname> 3.13.0-29-generic #53-Ubuntu SMP Wed Jun 4 21:00:20 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
 
root@<hostname>:/etc/nginx# nginx -V
nginx version: nginx/1.7.3 (nginx-plus-r4)
built by gcc 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
TLS SNI support enabled
configure arguments: --build=nginx-plus-r4 --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_f4f_module --with-http_hls_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_session_log_module --with-http_stub_status_module --with-http_auth_request_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_spdy_module --with-ipv6 --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed'
 
_______________________________________________
nginx-ru mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx-ru

Ответить