Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

This web tier clustering sample applies to a Geronimo with Tomcat distribution.

Part 1 - Installing/Running the Clustering Example

Example Overview
This example demonstrates how to use host level clustering with the Tomcat web container in Geronimo. It contains the necessary attachments for setting up cluster members on three separate physical machines. The cluster configuration will allow the three cluster members to replicate httpsession data via memory to memory multicast communication. Also, a load balancer can be used to spray the incoming requests to the available cluster members. In this example, we recommend Apache HTTP server and Apache mod_jk.

Installing the Example
This example contains 6 7 attachments:

  • config.xml - Geronimo Configuration Plan (for Geronimo v1.1.1)

...

Each geronimo cluster member must have a unique jvmRoute designation. The jvmRoute attribute allows the mod-jk load balancer to provide "sticky session" (sending all requests for the same httpsession to the same cluster member). This is possible since the load balancer places the jvmRoute value in the session cookie (or encoded url) that is returned to the web browser.

...

Once you get the applications installed on each cluster member, you can test httpsession replication by hitting the application with your favorite browser. Probably something like: http://localhost:8080/servlets-examples-cluster/servlet/SessionExampleImage Removed . Note that the output page contains the ID of the server that is servicing the request. In your browser window, fill in the appropriate input fields and hit the submit button. The console dialogue (the prompt where you started geronimo) should show that that httpsession data is being transmitted and received between the cluster members. Note that the transmit/receive confirmation messages in the log are only present for Tomcat 5.5.12.

...

Install Apache HTTP server - instructions and downloads available at http://httpd.apache.org/Image Removed
Install Apache mod_jk - See http://tomcat.apache.org/tomcat-5.5-doc/balancer-howto.htmlImage Removed

Configuration tips for mod_jk:
worker.list=loadbalancer,status
worker.node1.port=8009
worker.node1.host=your.first.cluster.member.host.name
worker.node1.type=ajp13
worker.node1.lbfactor=1

...

Once you get Apache HTPP Server and mod_jk setup correctly.. You can test load balancing and failover by requesting the following URLs on port 80 (Apache HTTP Server default port).

http://Yourhost/servlets-examples-clusterImage Removed - HttpSession is not used here, hence no sticky session http://Yourhost/servlets-examples-cluster/servlet/SessionExampleImage Removed - HttpSession is used here, hence sticky session should be in effect

...

  • When testing using a web browser, make sure that you erase cookies and cached pages between test cases. Browser caching can cause confusion when testing.
  • Make sure your application has the distributable attribute defined in web.xml
  • Memory to memory replication currently requires that all cluster members must reside on the same physical subnet since multicast broadcast is used. Make sure all cluster members are on the same physical subnet and that multicast broadcast is supported on the subnet.

Also, see http://tomcat.apache.org/tomcat-5.0-doc/cluster-howto.htmlImage Removed for more information on tomcat clustering.

...