Тъкмо това подготвях с малко инфо от логовете, изпревари ме

gdo1 с вътрешно ip: 10.10.10.1 (Сървър 1)
gdo2 с вътрешно ip: 10.10.10.2 (Сървър 2)
gdo3 с вътрешно ip: 10.10.10.3 (Сървър 3 - backup server)
Свързаността между сървърите е наред.
Сървър1:
nginx.conf
user www-data;
worker_processes 2;
# ulimit
worker_rlimit_nofile 65535;
pid /var/run/nginx.pid;
events {
worker_connections 10240;
use epoll;
# multi_accept on;
}
http {
# The Apache load balancing proxy targets for port 80 traffic
upstream gdo_lb {
server 127.0.0.1:8080;
server gdo2;
server gdo3 backup;
}
# Proxies for port 443 traffic
upstream gdo_slb {
server 127.0.0.1:10443;
server gdo2;
server gdo3 backup;
}
##
# Basic Settings
##
sendfile on;
#tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 10;
types_hash_max_size 2048;
server_tokens off;
client_max_body_size 40M;
client_body_buffer_size 128k;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
gzip_proxied any;
gzip_comp_level 2;
# gzip_buffers 16 8k;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
proxy_params еднакъв на всички сървъри
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 90;
proxy_send_timeout 300;
proxy_read_timeout 300;
proxy_buffer_size 16k;
proxy_buffers 32 64k;
proxy_busy_buffers_size 128k;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
Сървър 2
nginx.conf - различава се само частта, която е за upstream от Сървър 1
# The Apache load balancing proxy targets for port 80 traffic
upstream gdo_lb {
server 127.0.0.1:8080;
server gdo1;
server gdo3 backup;
}
# Proxies for port 443 traffic
upstream gdo_slb {
server 127.0.0.1:10443;
server gdo1;
server gdo3 backup;
}
Сървър 3:
nginx.conf - различава се само частта, която е за upstream от Сървър 1
# The Apache load balancing proxy targets for port 80 traffic
upstream gdo_lb {
server 127.0.0.1:8080;
server gdo1;
server gdo2;
}
# Proxies for port 443 traffic
upstream gdo_slb {
server 127.0.0.1:10443;
server gdo1;
server gdo2;
}
nginx vhost на всички сървъри
server {
listen 80;
server_name mydomain.tld;
access_log /var/log/nginx/mydomain.tld.access.log;
error_log /var/log/nginx/mydomain.tld.error.log;
location / {
proxy_pass http://gdo_lb;
include /etc/nginx/proxy_params;
}
}
Това, което виждам в логовете:
Сървър1:
2012/11/05 23:00:00 [error] 17941#0: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 10.10.10.2, server: mydomain.tld, request: "GET / HTTP/1.0", upstream: "http://127.0.0.1:8080/", host: "mydomain.tld"
2012/11/05 23:00:31 [error] 17941#0: *3413 connect() failed (111: Connection refused) while connecting to upstream, client: 89.215.8.109, server: mydomain.tld, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "mydomain.tld"
2012/11/05 23:00:42 [error] 17941#0: *3413 connect() failed (111: Connection refused) while connecting to upstream, client: 89.215.8.109, server: mydomain.tld, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "mydomain.tld"
Сървър 2 logs:
2012/11/05 23:00:31 [error] 6613#0: *3413 connect() failed (111: Connection refused) while connecting to upstream, client: 10.10.10.1, server: mydomain.tld, request: "GET / HTTP/1.0", upstream: "http://127.0.0.1:8080/", host: "mydomain.tld"
2012/11/05 23:00:42 [error] 6613#0: *4778 connect() failed (111: Connection refused) while connecting to upstream, client: 10.10.10.1, server: mydomain.tld, request: "GET / HTTP/1.0", upstream: "http://127.0.0.1:8080/", host: "mydomain.tld"
П.С. Това, което виждам сега като пуснах дебъга на nginx е че се 10.10.10.1 и 10.10.10.2 зациклят помежду си някак и X-Forwarded-For хедъра става по-голям и по-голям, докато не достигне лимита си. Ето парче от лога:
X-Real-IP: 10.10.10.2
X-Forwarded-For: 89.215.8.109, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2, 10.10.10.1, 10.10.10.2
Connection: close
П.С.2 Ако съм пропуснал нещо само кажете