0

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;
    }

}
asleea
  • 159
  • 1
  • 1
  • 8
  • 1
    Were you expecting nginx to disconnect clients from healthy backends? – Michael Hampton Aug 09 '16 at 09:14
  • @Michael Hampton : Yes and then it tries to reconnect to the server which gets alive so that the traffic can be balanced. I think it is natural otherwise the traffic is focused on the others even though there is an additional server not assigned. – asleea Aug 09 '16 at 09:40

0 Answers0