tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: How to configure failover for Apache/Tomcat?
Date Thu, 30 Jul 2009 16:03:12 GMT
Hash: SHA1


On 7/30/2009 11:35 AM, Li,Henry wrote:
> I have two Apache web servers, two app servers with
> four Tomcat instances running on them (two Tomcat instances on each
> server). All four servers run on Red Hat Linux. Current configuration
> is: web1 connected to app1 only, web2 connected to app2 only.


web1 ---> app1 [ Tomcat 1a, Tomcat 1b]
web2 ---> app2 [ Tomcat 1a, Tomcat 2b]


> If
> app1 is down, all users connected to web1 are out. Is it possible  to
> configure web1 connecting to both app1 and app2 so failover will be
> available?

Yes. Given your existing configuration, it seems that using mod_jk to
connect your Apache httpd instances to Tomcat is the right way to go:
mod_jk supports clustering and load balancing in (roughly) the following

1. Create a worker for each back-end Tomcat instance you have
2. Collect all the workers above into a "balancer" worker that will
   really multiplex between the workers defined in step 1
3. Session-less users are routed to whichever back-end server makes
   sense based upon your chosen load balancing algorithm
4. Users /with/ sessions are always router to the server that "owns"
   their session
5. When a server fails, mod_jk detect this and forwards requests to
   one of the other members of the cluster
6. When the failed node comes back up, it re-joins the cluster and
   everything goes back to normal

Note that you can either implement sticky sessions (as I have described
above), or you can use session replication across your cluster. I'm not
a big fan of session replication because of all the messages that need
to be sent around. For my production purposes, requiring a user to login
again when failover occurs is acceptable. For me, the complexity of
session replication is not necessary. Your requirements may differ.

For more information on mod_jk balancing and clustering, see this page:

This page presupposes an understanding of how mod_jk is configured. If
you haven't used mod_jk before, start here:
and read the links for "All about workers", "For the impatient", and the
reference guide for Apache. If you have more questions, post back to the

> What extra hardware  and/or software do I need?

You'll want a hardware load-balancer to balance between web1 and web2.
As for software, just adding mod_jk to the mix should do it.

- -chris
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message