1
我對這個配置有問題。我的AWS ELB接受端口80上的TCP連接,並使用代理協議將它們轉發到監聽端口8080的nginx實例。此nginx節點應該使用ip_hash模塊將用戶粘貼到特定節點。AWS ELB - > nginx - > socket.io node.js粘性負載平衡
這是工作完全正常,但只有2出了4個節點的正在使用的,而不是被負載各方進行平衡,這是我的nginx的配置
upstream socket_nodes {
ip_hash;
server a.server.com:2000;
server a.server.com:2001;
server a.server.com:2002;
server a.server.com:2003;
}
# Accept connections via the load balancer
server {
listen 8080 proxy_protocol;
set_real_ip_from 0.0.0.0/32;
real_ip_header proxy_protocol;
charset utf-8;
location/{
proxy_pass http://socket_nodes;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
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_set_header X-Forwarded-Proto $scheme;
}
}