AW: Sticky sessions with Apache and Tomcat

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Did you check the session cookie in your browser? 
There should be one and it must end with either .jvm1 or .jvm2.
If there is no session cookie, maybe your application didn't yet start a session - e.g. static html pages are served w/o a session.

Cheers
Jürgen


> -----Ursprüngliche Nachricht-----
> Von: tomcatastrophe [mailto:nabble@xxxxxxxxxxxxxxxx] 
> Gesendet: Montag, 13. Juli 2009 19:23
> An: users@xxxxxxxxxxxxxxxx
> Betreff:  Sticky sessions with Apache and Tomcat
> 
> 
> 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-t
> p24465853p24465853.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@xxxxxxxxxxxxxxxx
>    "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
> 
> 
---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux