tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Babu Satasiya <babulalsatas...@gmail.com>
Subject Re: [OT] A Howto for Tomcat 6.0.9, mod_jk, apache 2.2 load balancing + session replication
Date Tue, 13 Feb 2007 20:10:49 GMT

Hi,

Please update about cluster option in server.xml, without that how does it
work. If you can post all the steps will help others, otherwise it may even
confuse to others.

Thanks for posting on session replication, please let me know if we anyone
have live application and if they go for session replication which you
explain is method using session in memory. Will they need to do anything in
application or not?

With regards,

Babulal Satasiya


Sriram Narayanan wrote:
> 
> Hi all:
> 
> I just got this working, so I thought of posting a small howto for the
> list :)
> 
> ================================================
> 
> An apache instance (httpd) that serves http://localhost/examples/
> where /examples is served by two Tomcat instances (if one is
> down/unavailable, then httpd decides to redirect requests to the
> second tomcat instances.
> 
> What I've got working so far:
> - Session replication between the various Tomcat instances in the cluster.
> - In case one instance is not available, then apache sends new
> requests to the next instance.
> - When and instance comes back, it joins the cluster, receives session
> replication, and is ready to take over when required.
> 
> What else is possible:
> - Load balance based on the number of requests already sent to a Tomcat
> instance
> - Configure timeouts, etc
> - More information at
> http://tomcat.apache.org/connectors-doc/reference/workers.html
> 
> What's not possible:
> - If the first instance dies, then the second instance carries on
> processing from that point.
> 
> To try this yourself:
> 1. Download and install Apache Tomcat 6.0.9
> 
> 2. In server.xml, uncomment the tag for clustering
> 
> 3. Edit the webapps/example/WEB-INF/web.xml to include the distributable
> tag
> 	<distributable/>
> 
> 4. Create a copy of this Tomcat folder (say, Tomcat2)
> 
> 5. Edit the server.xml in Tomcat2. Change all the port numbers. e.g.
> change the AJP port number to 8010
> 
> 6. Download the file
> http://mirrors.24-7-solutions.net/pub/apache/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.20/mod_jk-apache-2.2.3.so
> and save it as mod_jk.so at apache/modules folder.
> 
> 7. Place the following contents in the file apache/conf/worker.properties
> 	# The advanced router LB worker
> 	  worker.list=router,worker2,worker1
> 	
> 	  # Define a worker using ajp13
> 	  worker.worker1.port=8009
> 	  worker.worker1.host=localhost
> 	  worker.worker1.type=ajp13
> 	  worker.worker1.lbfactor=1
> 	  # Define prefered failover node for worker1
> 	  worker.worker1.redirect=worker2
> 	
> 	  # Define another worker using ajp13
> 	  worker.worker2.port=8010
> 	  worker.worker2.host=localhost
> 	  worker.worker2.type=ajp13
> 	  worker.worker2.lbfactor=1
> 	  worker.worker2.mount=/examples/*
> 	  # Disable worker2 for all requests except failover
> 	  worker.worker2.activation=disabled
> 	
> 	  # Define the LB worker
> 	  worker.router.type=lb
> 	  worker.router.balance_workers=worker1,worker2
> 	
> 	  worker.list=jkstatus
> 	  # Define a 'jkstatus' worker using status
>   worker.jkstatus.type=status
> 
> 8. Edit apache/conf/httpd.conf to include the following:
> LoadModule    jk_module  modules/mod_jk.so
> 
> #AddModule     mod_jk.c
> 
> JkWorkersFile conf/worker.properties
> 
> JkShmFile     mod_jk.shm
> JkLogFile     mod_jk.log
> 
> JkLogLevel    info
> JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
> 
> JkMount /jkmanager/* jkstatus
> 
> JkMount  /examples/* router
> 
> 9. Start the two Tomcat instances
> 	You should see some replication related messages in the console
> 
> 	Feb 13, 2007 8:01:34 PM org.apache.catalina.ha.tcp.SimpleTcpCluster
> memberAdded
> 	INFO: Replication member
> added:org.apache.catalina.tribes.membership.MemberImpl[
> 
> tcp://Ramn.corporate.thoughtworks.com:4001,Ramn.corporate.thoughtworks.com,4001,
> 	 alive=1016,id={99 34 -19 82 10 -107 64 51 -119 77 9 -117 -91 9 24 -9
> }, payload
> ={}, command={}, domain={}, ]
> 
> INFO: Manager [localhost#/examples]; session state send at 2/13/07 8:01 PM
> recei
> ved in 125 ms.
> 
> 
> 10. Restart the httpd web server
> 
> Testing the session replication
> 1. Browse to http://localhost/examples/
> 
> 2. Try the Session examples for the servlet.
> 
> 3. Set a variable into the session with a value
> 
> 4. Stop the first Tomcat instance
> 
> 5. Set another variable into the session.
> 	This time, the second Tomcat instance will serve the content
> 	You'll see that the first variable is still in the session. This is a
> sign that replication has been successful.
> 
> 6. Restart the first instance, wait for it to enter the cluster and
> for the replication to happen
> INFO: Manager [localhost#/examples]; session state send at 2/13/07 8:01 PM
> recei
> ved in 125 ms.
> 
> 7. Stop the second Tomcat instance.
> 
> 8. Set another variable into the session.
> 
> 9. You'll see that all the variables are still available.
> 
> -- Sriram
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/A-Howto-for-Tomcat-6.0.9%2C-mod_jk%2C-apache-2.2-load-balancing-%2B-session-replication-tf3221269.html#a8952084
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message