httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomcatastrophe <nab...@changethings.org>
Subject [users@httpd] Sticky sessions with Apache and Tomcat
Date Mon, 13 Jul 2009 17:22:43 GMT

I am trying to set up simple load balancing between Apache and two Tomcat
instances, but am having problems with sticky sessions.

I get thrown back and forth between the instances on each request. (I put a
note at the top of the page on each instance to distinguish where the page
has been served from and each request sends me back to the other server. I
see "instance 1" at the top of the page, then refresh and see instance 2,
then refresh and see instance 1 again, etc)

My Apache Virtual Host:

<VirtualHost *:80>
     DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Tomcat
6.0/sites/foo/ROOT/"
     ServerName foo.com
     ServerAlias www.foo.com
     DirectoryIndex index.php

     <Directory "C:/Program Files (x86)/Apache Software Foundation/Tomcat
6.0/sites/foo/ROOT/">
     Allow from all
     </Directory>


     ProxyPreserveHost On
     ProxyPassReverse / ajp://192.168.1.2:8009/
     ProxyPassReverse / ajp://192.168.1.3:8009/
	 
     ProxyPass / balancer://mycluster stickysession=JSESSIONID|jsessionid
nofailover=Off
	 
     ProxyPass /balancer-manager !
	 
     RewriteEngine On
     RewriteRule ^/(.*)$ balancer://mycluster/$1 [P,L,R]
	 
<Proxy balancer://mycluster>
	BalancerMember ajp://192.168.1.2:8009/ route=jvm1 loadfactor=50
	BalancerMember ajp://192.168.1.3:8009/ route=jvm2 loadfactor=50
	ProxySet lbmethod=byrequests
</Proxy>

<Location /balancer-manager>
        SetHandler balancer-manager
        Order Deny,Allow
        Deny from all
        Allow from 127.0.0.1
</Location>

</VirtualHost> 


My two Tomcat instances are set up as:

    <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1">   

 and

    <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm2">   


Basically, what I want to happen is when I type in http://foo.com in the
browser I am taken to jvm1 instance, when I type the same thing in another
browser (new session) I am taken to jvm2 instance.

Then, everytime I visit any page on foo.com from either browser, I am always
served from the original instance I was assigned.

Any help?

Thanks!!!
-- 
View this message in context: http://www.nabble.com/Sticky-sessions-with-Apache-and-Tomcat-tp24465853p24465853.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message