I want to balance web-socket
with Nginx
.
When it connects first, it balances the connections.
When a server among upstream is failed, it also does re-balance web-socket
connections.
However, even when the server is recovered, Nginx
still retain the connection not re-balancing with the server which gets alive.
Is there any way for Nginx
to balance again automatically?
The below is my part of Nginx
config file.
upstream s2s_host{
hash $remote_port;
server 10.2.150.211:10001 max_fails=0 fail_timeout=10s;server 10.2.150.212:10001 max_fails=0 fail_timeout=10s;
}
server {
listen 10.2.10.204:10002;
location = /s2s {
proxy_read_timeout 365h;
proxy_send_timeout 365h;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://s2s_host;
}
}