I'm not sure if this is what you are looking for but I just checked how our 
stuff is set up here and wondered if you have the jvm route mapped in the 
server xml for the tomcat instances you want loadbalanced?

<Engine jvmRoute="route_7" name="Catalina" defaultHost="localhost">

Paul



-----Original Message-----
From: Gabriel Tabares [mailto:gabriel.taba...@roboreus.com]
Sent: 30 June 2010 11:17
To: users@tomcat.apache.org
Subject: Hello and Tomcat issues with sticky sessions

Hi everybody,

I have been running Tomcat on production for a few years with no problem
but now, after moving to a new company, I am completely unable to get
session stickyness working.

The setup is as follows:

Apache 2.2.3 (CentOS 5.4 version) -> Tomcat 6.0.24.

I have tried all of mod_proxy, mod_ajp_proxy and mod_jk but, no matter
what I do, I can not get Apache to always send the requests to the
Tomcat specified in the jsession.

Firebug indicates that the JSESSIONID cookie is being set as it should
but it still sees requests going to the other server. I have also tried
changing the jvmRoute to exactly match the worker name for mod_jk but it
still doesn't work.

I would appreciate any help, as I am stuck.

Here are the configurations I have tried. Obviously, only of them is
active at any given time. httpd.conf is the standard one from the CentOS
RPM.

Tomcats:

All of them have a jvmRoute of pub-app0X, where X goes from 1 to 5.

mod_proxy
========
proxy.conf
-----------

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_http_module modules/mod_proxy_http.so

ProxyRequests Off

<Proxy balancer://public_web_cluster>
     Order deny,allow
     Allow from all

     BalancerMember http://app01:8080 route=pub-app01
     BalancerMember http://app02:8080 route=pub-app02
     BalancerMember http://app03:8080 route=pub-app03
     BalancerMember http://app04:8080 route=pub-app04
     BalancerMember http://app05:8080 route=pub-app05
</Proxy>

virtual.conf
------------
LogLevel Debug

<VirtualHost 10.1.2.1:80>
     DocumentRoot /var/www/html
     ServerName www.myserver.com
     ServerAlias myserver.com

         RewriteEngine On
         RewriteRule ^/$ /appname/ [R]
         RewriteRule ^$ /appname/ [R]

<Location />
         AuthType Basic
         AuthName "Please enter your details"
         AuthUserFile /etc/httpd/conf.d/htpasswd
         Require valid-user

         ProxyPass balancer://public_web_cluster/
stickysession=JSESSIONID lbmethod=byrequests
         ProxyPassReverse balancer://public_web_cluster/
</Location>
</VirtualHost>

mod_ajp_proxy
===========

mod_proxy_ajp.conf
----------------------

LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

<Proxy balancer://pubLB>
BalancerMember ajp://app01:8009/ timeout=5 route=pub-app01
BalancerMember ajp://app02:8009/ timeout=5 route=pub-app02
BalancerMember ajp://app03:8009/ timeout=5 route=pub-app03
BalancerMember ajp://app04:8009/ timeout=5 route=pub-app04
BalancerMember ajp://app05:8009/ timeout=5 route=pub-app05
</Proxy>

virtual.conf
-----------
ProxyRequests Off
<VirtualHost 10.1.2.1:80>
     DocumentRoot /var/www/html
     ServerName www.myserver.com
     ServerAlias myserver.com

         RewriteEngine On
         RewriteRule ^$ /myapp [R]
         RewriteRule ^/$ /myapp [R]

<Location />
         AuthType Basic
         AuthName "Please enter your details"
         AuthUserFile /etc/httpd/conf.d/htpasswd
         Require valid-user

         ProxyPass balancer://pubLB/ stickysession=JSESSIONID nofailover=on
         ProxyPassReverse balancer://pubLB/
</Location>
</VirtualHost>

mod_jk
=====

mod_jk.conf
-------------
LoadModule jk_module modules/mod_jk.so

JkWorkersFile /etc/httpd/conf.d/workers.properties
JkLogFile     /var/log/httpd/mod_jk.log
JkLogLevel    debug
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

workers.properties
-------------------
ps=/

worker.list=pub-app01, pub-app02, pub-app03, pub-app04, pub-app05, pub-lb

worker.pub-app01.type=ajp13
worker.pub-app01.host=app01
worker.pub-app01.port=8009
worker.pub-app01.socket_keepalive=1

worker.pub-app02.type=ajp13
worker.pub-app02.host=app02
worker.pub-app02.port=8009
worker.pub-app02.socket_keepalive=1

worker.pub-app03.type=ajp13
worker.pub-app03.host=app03
worker.pub-app03.port=8009
worker.pub-app03.socket_keepalive=1

worker.pub-app04.type=ajp13
worker.pub-app04.host=app04
worker.pub-app04.port=8009
worker.pub-app04.socket_keepalive=1

worker.pub-app05.type=ajp13
worker.pub-app05.host=app05
worker.pub-app05.port=8009
worker.pub-app05.socket_keepalive=1

worker.ajp13.lbfactor=1

worker.pub-lb.type=lb
worker.pub-lb.balance_workers=pub-app01,pub-app02,pub-app03,pub-app04,pub-app05
worker.pub-lb.sticky_session=1

virtual.conf
-----------

<VirtualHost 10.1.2.1:80>
     DocumentRoot /var/www/html
     ServerName www.myserver.com

    JkMount /myapp/* pub-lb

<Location />
         AuthType Basic
         AuthName "Please enter your details"
         AuthUserFile /etc/httpd/conf.d/htpasswd
         Require valid-user

</Location>
</VirtualHost>

------------------------------

Thanks in advance.

Gabriel




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



********************************************************************************************************************

This message may contain confidential information. If you are not the intended 
recipient please inform the
sender that you have received the message in error before deleting it.
Please do not disclose, copy or distribute information in this e-mail or take 
any action in reliance on its contents:
to do so is strictly prohibited and may be unlawful.

Thank you for your co-operation.

NHSmail is the secure email and directory service available for all NHS staff 
in England and Scotland
NHSmail is approved for exchanging patient data and other sensitive information 
with NHSmail and GSI recipients
NHSmail provides an email address for your career in the NHS and can be 
accessed anywhere
For more information and to find out how you can switch, visit 
www.connectingforhealth.nhs.uk/nhsmail

********************************************************************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to