Thank you Chris! I did not use mod_jk before. I will start from the beginning.
Henry -----Original Message----- From: Christopher Schultz [mailto:ch...@christopherschultz.net] Sent: Thursday, July 30, 2009 11:03 AM To: Tomcat Users List Subject: Re: How to configure failover for Apache/Tomcat? -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Henry, 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. So: web1 ---> app1 [ Tomcat 1a, Tomcat 1b] web2 ---> app2 [ Tomcat 1a, Tomcat 2b] Right? > 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 way: 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: http://tomcat.apache.org/connectors-doc/generic_howto/loadbalancers.html This page presupposes an understanding of how mod_jk is configured. If you haven't used mod_jk before, start here: http://tomcat.apache.org/connectors-doc/ 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 list. > 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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkpxxEAACgkQ9CaO5/Lv0PCPFACfbRe3JJwEJhcgGW89bYP8wRrE 7EsAn0N3dM9qCB5thWTq0aFIiJEhbr/I =pM8p -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org