You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Gabriel Tabares <ga...@roboreus.com> on 2010/06/30 12:16:51 UTC

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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Hello and Tomcat issues with sticky sessions

Posted by Rainer Jung <ra...@kippdata.de>.
On 30.06.2010 16:18, János Löbb wrote:
>> 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
>>
>
> - I think this is what worker.list should look like:
>
> worker.list=pub-lb

Aaaah, right. The above won't work, the lb worker needs to be in the 
list, not the members of the lb. with recent versions of mod_jk you 
would find a message in the log, that the worker "pub-lb" used in your 
JkMount isn't known to mod_jk (because it is missing in the list attribute).

> - You might also need for every balance_worker the
> worker.pub-app0x.redirect=machine_name_where_the_session_from_this_machine_should_be_redirected

You can use it if you have a very special idea, which node should fail 
over to which other node, but you can omit it and the balancer will 
choose one on a per request basis, if there is a problem with a node.

> - For the load balance worker you might need something like:
> worker.pub-lb.sticky_session_force=False
> worker.pub-lb.sticky_session=True

Those are both defaults.

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


Re: Hello and Tomcat issues with sticky sessions

Posted by János Löbb <ja...@yale.edu>.
> 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
> 

- I think this is what worker.list should look like:

worker.list=pub-lb

- You might also need for every balance_worker the 
worker.pub-app0x.redirect=machine_name_where_the_session_from_this_machine_should_be_redirected

- For the load balance worker you might need something like:
worker.pub-lb.sticky_session_force=False
worker.pub-lb.sticky_session=True

I am getting these from my 6.0.18 config, so they might be outdated.

János


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


RE: Hello and Tomcat issues with sticky sessions

Posted by "Ockleford Paul (NHS Connecting for Health)" <pa...@nhs.net>.
Yes sorry! Slow morning here today.. :)

From: M.H.G. Emmerig [mailto:M.H.G.Emmerig@DNB.NL]
Sent: 30 June 2010 11:33
To: Tomcat Users List
Subject: RE: Hello and Tomcat issues with sticky sessions


you beat me to it I think

regards

Milko Emmerig

"Ockleford Paul (NHS Connecting for Health)" <pa...@nhs.net>

30-06-2010 12:31
Please respond to
"Tomcat Users List" <us...@tomcat.apache.org>



To


Tomcat Users List <us...@tomcat.apache.org>


cc




Subject


RE: Hello and Tomcat issues with sticky sessions








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.tabares@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org




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.

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

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

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

Re: Hello and Tomcat issues with sticky sessions

Posted by Gabriel Tabares <ga...@roboreus.com>.
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
>>
>>      
>    
>> Tomcats:
>>
>> All of them have a jvmRoute of pub-app0X, where X goes from 1 to 5.
>>
>> mod_proxy
>> ========
>> proxy.conf
>> -----------
>>
>>      
>    
>>          ProxyPass balancer://public_web_cluster/
>> stickysession=JSESSIONID lbmethod=byrequests
>>          ProxyPassReverse balancer://public_web_cluster/
>> </Location>
>> </VirtualHost>
>>
>> mod_ajp_proxy
>> ===========
>>
>> mod_proxy_ajp.conf
>> ----------------------
>>      
>    
>>          ProxyPass balancer://pubLB/ stickysession=JSESSIONID nofailover=on
>>          ProxyPassReverse balancer://pubLB/
>> </Location>
>> </VirtualHost>
>>
>>      
>
> This isn't likely to be the core problem, but it's worth bearing in
> mind.  If you're using mod_proxy you need to put:
>
>   stickysession=JSESSIONID|jsessionid
>
>    
I have tried both ways and I still get no stickyness. I was trying to 
simplify it in order to check minimise the possibility of errors.

> to ensure you're capturing both the URL encoded and cookie based session
> ids.  Unfortunately, because RHEL/Centos insist on deploying HTTPD with
> the version number set when they released the OS, it's virtually
> impossible to tell whether your HTTP is actually 2.2.3, or 2.2.3 +
> important fixes, additions etc from 2.2.(n>  3).
>
> mod_proxy_ajp was first released in 2.2.3 for example, and many
> improvements occurred in later releases.
>
>    

The CentOS version is 2.2.3 + a million patches. The only way to find 
out what they have changed is to go through the changelogs.

It makes things more stable from an API point of view but it surely 
makes hard not only finding out where the issue lies, but also if 
upgrading version will fix it.

Thanks

Gabriel

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


Re: Hello and Tomcat issues with sticky sessions

Posted by Pid <pi...@pidster.com>.
On 30/06/2010 11:33, M.H.G. Emmerig wrote:
> you beat me to it I think
> 
> regards
> 
> Milko Emmerig

> 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
> 

> Tomcats:
> 
> All of them have a jvmRoute of pub-app0X, where X goes from 1 to 5.
> 
> mod_proxy
> ========
> proxy.conf
> -----------
> 

> 
>         ProxyPass balancer://public_web_cluster/
> stickysession=JSESSIONID lbmethod=byrequests
>         ProxyPassReverse balancer://public_web_cluster/
> </Location>
> </VirtualHost>
> 
> mod_ajp_proxy
> ===========
> 
> mod_proxy_ajp.conf
> ----------------------

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


This isn't likely to be the core problem, but it's worth bearing in
mind.  If you're using mod_proxy you need to put:

 stickysession=JSESSIONID|jsessionid

to ensure you're capturing both the URL encoded and cookie based session
ids.  Unfortunately, because RHEL/Centos insist on deploying HTTPD with
the version number set when they released the OS, it's virtually
impossible to tell whether your HTTP is actually 2.2.3, or 2.2.3 +
important fixes, additions etc from 2.2.(n > 3).

mod_proxy_ajp was first released in 2.2.3 for example, and many
improvements occurred in later releases.


p


RE: Hello and Tomcat issues with sticky sessions

Posted by "M.H.G. Emmerig" <M....@DNB.NL>.
you beat me to it I think

regards

Milko Emmerig

                                                                           
             "Ockleford Paul                                               
             (NHS Connecting                                               
             for Health)"                                               To 
             <paul.ockleford@n         Tomcat Users List                   
             hs.net>                   <us...@tomcat.apache.org>           
                                                                        cc 
             30-06-2010 12:31                                              
                                                                   Subject 
                                       RE: Hello and Tomcat issues with    
             Please respond to         sticky sessions                     
               "Tomcat Users                                               
                   List"                                                   
             <users@tomcat.apa                                             
                 che.org>                                                  
                                                                           
                                                                           




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.tabares@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org




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.

Re: Hello and Tomcat issues with sticky sessions

Posted by Gabriel Tabares <ga...@roboreus.com>.
>> I now have made the change and it seems to be working (fingers crossed).
>> I have a couple of people testing it out, so fingers crossed!
>>
OK, it now works correctly. The only issue I have is that Apache is now 
adding .number to the end of each request.

If I go to myapp/forum, the first time I get myapp/forum.1, the next 
time is myapp/forum.2, etc.

Any hints about this?

>> It's weird because I've used mod_jk a lot and never had any domain
>> specified.
>
> You won't need a domain setting for stickyness to work. There was 
> something else wrong with your setup.
>
> Since your configuration looked OK, mod_jk should have logged any 
> problems when doing stickyness in its log file.
>
I will look into it when I get more time after we launch the product. I 
will then have time to investigate why.

Regards,

Gabriel


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


Re: Hello and Tomcat issues with sticky sessions

Posted by Rainer Jung <ra...@kippdata.de>.
On 30.06.2010 13:10, Gabriel Tabares wrote:
> have you also set de directive in de workers.properties I suggested?
>>
>>
>> in your case that should look like
>>
>> worker.pub-app01.domain=pub-app01
>> etc
>>
>
> My apologies, I am doing 10 things at the time and missed that bit.
>
> I now have made the change and it seems to be working (fingers crossed).
> I have a couple of people testing it out, so fingers crossed!
>
> It's weird because I've used mod_jk a lot and never had any domain
> specified.

You won't need a domain setting for stickyness to work. There was 
something else wrong with your setup.

Since your configuration looked OK, mod_jk should have logged any 
problems when doing stickyness in its log file.

Regards,

Rainer

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


Re: Hello and Tomcat issues with sticky sessions

Posted by Gabriel Tabares <ga...@roboreus.com>.
have you also set de directive in de workers.properties I suggested?
>
>
> in your case that should look like
>
> worker.pub-app01.domain=pub-app01
> etc
>

My apologies, I am doing 10 things at the time and missed that bit.

I now have made the change and it seems to be working (fingers crossed). 
I have a couple of people testing it out, so fingers crossed!

It's weird because I've used mod_jk a lot and never had any domain 
specified.

Thanks for your help.

Gabriel



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


Re: Hello and Tomcat issues with sticky sessions

Posted by "M.H.G. Emmerig" <M....@DNB.NL>.
Gabriel

have you also set de directive in de workers.properties I suggested?

in your case that should look like

worker.pub-app01.domain=pub-app01
etc

Milko



                                                                           
             Gabriel Tabares                                               
             <gabriel.tabares@                                             
             roboreus.com>                                              To 
                                       users@tomcat.apache.org             
             30-06-2010 12:41                                           cc 
                                                                           
                                                                   Subject 
             Please respond to         Re: Hello and Tomcat issues with    
               "Tomcat Users           sticky sessions                     
                   List"                                                   
             <users@tomcat.apa                                             
                 che.org>                                                  
                                                                           
                                                                           
                                                                           




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
>
>

Sorry if it wasn't clear on my original message, they already have the
jvmRoute set:

<Engine name="Catalina" defaultHost="localhost" jvmRoute="pub-app01">
for the first, server
<Engine name="Catalina" defaultHost="localhost" jvmRoute="pub-app02">
for the second, etc.


>
> -----Original Message-----
> From: Gabriel Tabares [mailto:gabriel.tabares@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-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@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-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


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




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.

Re: Hello and Tomcat issues with sticky sessions

Posted by Gabriel Tabares <ga...@roboreus.com>.
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
>
>    

Sorry if it wasn't clear on my original message, they already have the 
jvmRoute set:

<Engine name="Catalina" defaultHost="localhost" jvmRoute="pub-app01"> 
for the first, server
<Engine name="Catalina" defaultHost="localhost" jvmRoute="pub-app02">  
for the second, etc.


>
> -----Original Message-----
> From: Gabriel Tabares [mailto:gabriel.tabares@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-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@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-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>    


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


RE: Hello and Tomcat issues with sticky sessions

Posted by "Ockleford Paul (NHS Connecting for Health)" <pa...@nhs.net>.
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.tabares@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Hello and Tomcat issues with sticky sessions

Posted by "M.H.G. Emmerig" <M....@DNB.NL>.
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 
                                       users@tomcat.apache.org             
             30-06-2010 12:16                                           cc 
                                                                           
                                                                   Subject 
             Please respond to         Hello and Tomcat issues with sticky 
               "Tomcat Users           sessions                            
                   List"                                                   
             <users@tomcat.apa                                             
                 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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org




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.