Fwd: NGINX config for websocket HA failover

Hi,

I would like to use NGINX for failover in my HA setup. I have two VMs
running in Active-Active mode and listening on 9080 port for WebSocket
connections from clients. I would like to use NGINX to route all
websocket
traffic to route to VM1 and must route to VM2 only on failure of VM1.

NGINX is running on my windows, If I use the following config, is it
enough?

http {

upstream web_rack {

server vm1:9080;

server vm2:9080;

}

server {

listen 80;

server_name localhost;

location / {

proxy_pass http://web_rack;

proxy_http_version 1.1;

proxy_set_header Upgrade websocket;

proxy_set_header Connection upgrade;

}

}

}

What changes I need to do in config to add the failover mechanism to
allow
NGINX to route websocket traffic to vm2 only on vm1 failure?

Thanks and regards,

Hari

Hello!

On Mon, May 26, 2014 at 05:51:11PM +0530, Hari Poludasu wrote:

http {

upstream web_rack {

server vm1:9080;

server vm2:9080;

}

[…]

What changes I need to do in config to add the failover mechanism to allow
NGINX to route websocket traffic to vm2 only on vm1 failure?

Use the “backup” flag on vm2, see here for details:

http://nginx.org/en/docs/http/ngx_http_upstream_module.html#server


Maxim D.
http://nginx.org/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs