Failover / fault-tolerant configurations

Hi,

I’m looking for more information on setting up 2 Nginx instances
in a failover active/active configuration.

The scenario that I’m trying to accomplish is this:

2 Nginx instances, both doing some sort of Session affinity
with, say the
http://wiki.codemongers.com/NginxHttpUpstreamRequestHashModule
module.

If one of the Nginx instance fails, I hope to have the second keep
handling incoming requests.


Now, I’m not sure if I’m verbalizing what I’m trying to do correctly,
but my general goal is to create a fault - tolerant setup.

Any advice is appreciated, especially any advice of best practices
in this general arena, Nginx limitations, or alternate configurations.

thanks,
Alex

If you have multiple machines running identically configured instances
of
nginx, then you can configure the IP failover using something like
wackamole
or heartbeat.
You won’t need anything special for the nginx configuration.
Session affinity can be enable in nginx using ip_hash directive of the
nginx
upstream module.
One thing this will not get you is session failover. In other words, if
your
active instance of nginx dies the current information about session
affinity
will also be lost.

http://wiki.codemongers.com/NginxHttpUpstreamModule#ip_hash
http://www.backhand.org/wackamole/
http://www.linux-ha.org/

-Jake

Alex,

If you just want to stick with Nginx then you could set one daemon up
as the proxy front end and two Nginx daemons behind it. If one of the
back ends fail (One or Two) then traffic will be sent to the other
back end.

                            /- Nginx back-end One

Internet – Nginx Loadbalanacer<
- Nginx back-end Two

If you use OpenBSD then you could use Pf or Relayd to do the job of
the fail-over load balancer. Relayd allows many checks of the back end
including ICMP, http error code or running custom scripts.

Hope this helps,


Calomel @ https://calomel.org
Open Source Research and Reference

On Wed, May 21, 2008 at 4:41 PM, alex clemesha [email protected]
wrote:

specific ways one can minimize / eliminate the loss of the
current session information, or is this not possible with Nginx?

None that I am aware of. But I image a sufficiently determined module
developer could create one.

-Jake

Store all session info in a separate database, keyed by ID?

On Wed, May 21, 2008 at 1:25 PM, J Davis [email protected] wrote:

If you have multiple machines running identically configured instances of
nginx, then you can configure the IP failover using something like wackamole
or heartbeat.
You won’t need anything special for the nginx configuration.
Ok, thanks. I’ve glanced at both wackamole and heartbeat before, but
I will now give them a closer look.

Session affinity can be enable in nginx using ip_hash directive of the nginx
upstream module.
One thing this will not get you is session failover. In other words, if your
active instance of nginx dies the current information about session affinity
will also be lost.
I had a feeling this might be the case. Are there any
specific ways one can minimize / eliminate the loss of the
current session information, or is this not possible with Nginx?

Thanks Jake,

-Alex