Hello gabriel
I think you should have the following in your configuration:
in de workers definition something like
worker.pub-app01.domain=pub-app01-jvm
and in your tomcat server.xml
<Engine name="Catalina" defaultHost="localhost" jvmRoute="pub-app01-jvm">
regards
Milko Emmerig
Gabriel Tabares
<gabriel.tabares@
roboreus.com> To
[email protected]
30-06-2010 12:16 cc
Subject
Please respond to Hello and Tomcat issues with sticky
"Tomcat Users sessions
List"
<[email protected]
che.org>
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: [email protected]
For additional commands, e-mail: [email protected]
Please consider the environment before printing this email.
De informatie verzonden met dit e-mailbericht is vertrouwelijk en
uitsluitend bestemd voor de geadresseerde. Indien u als niet-geadresseerde
dit bericht ontvangt, wordt u verzocht direct de afzender hierover te
informeren en het bericht te vernietigen. Gebruik van informatie door
onbevoegden, openbaarmaking of vermenigvuldiging is verboden en kan leiden
tot aansprakelijkheid. De afzender is niet aansprakelijk in geval van
onjuiste overbrenging van het e-mailbericht en/of bij ontijdige ontvangst
daarvan.
The information transmitted is confidential and intended only for the
person or entity to whom or which it is addressed. If you are not the
intended recipient of this communication, please inform us immediately and
destroy this communication. Unauthorised use, disclosure or copying of
information is strictly prohibited and may entail liability. The sender
accepts no liability for improper transmission of this communication nor
for any delay in its receipt.