Fwd: NGINX config for websocket HA failover

Maxim Dounin mdounin at mdounin.ru
Mon May 26 12:24:35 UTC 2014


Hello!

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

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

[...]

> 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 Dounin
http://nginx.org/



More information about the nginx mailing list