You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by 王科选 <ra...@gmail.com> on 2010/09/01 08:24:08 UTC
[users@httpd] sticky_session doesn't work
Hi, I'm using Apache/2.2.16 (Win32) mod_jk/1.2.30 , and had set the
sticky_session=1, but it doesn't work!
will someone help me please, thanks!
Here is the workers.properties:
worker.list = balancer,status
worker.tomcat1.port=8010
worker.tomcat1.host=10.3.1.17
worker.tomcat1.type=ajp13
worker.tomcat1.lbfactor = 1
worker.tomcat2.port=8010
worker.tomcat2.host=10.3.1.18
worker.tomcat2.type=ajp13
worker.tomcat2.lbfactor = 1
worker.balancer.type=lb
worker.balancer.balance_workers=tomcat1,tomcat2
worker.balancer.sticky_session=1
worker.status.type=status
And I'm also wondering how apache descides which tomcat a session
belongs to ?
---------------------------------------------------------------------
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
Re: [users@httpd] sticky_session doesn't work
Posted by Rainer Jung <ra...@kippdata.de>.
On 01.09.2010 08:24, 王科选 wrote:
> Hi, I'm using Apache/2.2.16 (Win32) mod_jk/1.2.30 , and had set the
> sticky_session=1, but it doesn't work!
>
> will someone help me please, thanks!
>
> Here is the workers.properties:
>
> worker.list = balancer,status
>
> worker.tomcat1.port=8010
>
> worker.tomcat1.host=10.3.1.17
> worker.tomcat1.type=ajp13
> worker.tomcat1.lbfactor = 1
>
> worker.tomcat2.port=8010
> worker.tomcat2.host=10.3.1.18
> worker.tomcat2.type=ajp13
> worker.tomcat2.lbfactor = 1
>
> worker.balancer.type=lb
> worker.balancer.balance_workers=tomcat1,tomcat2
> worker.balancer.sticky_session=1
>
> worker.status.type=status
>
> And I'm also wondering how apache descides which tomcat a session
> belongs to ?
The right list to discuss mod_jk is the Tomcat users mailing list.
To subscribe, send mail to
users-subscribe@tomcat.apache.org
I'll give you a short answer, but if you need to proceed discussion,
please repost to the other list.
sticky_session=1 is the default setting. In order to make sticky session
work, you need to ingredients.
1) You need to set the attribute jvmRoute in server.xml of Tomcat to an
individual value for each Tomcat instance. An example for setting
jvmRoute is contained as a comment in the default server.xml file. The
file is contained in the conf directory of Tomcat.
2) The member worker of the load balancer worker need to have the same
names as the jvmRoute of the Tomcat to which they connect. In your above
configuration those names are "tomcat1" and "tomcat2", so either you
choose "tomcat1" and "tomcat2" as the jvmRoute values, or you change the
names of the workers above to the jvmRoute values you have alredy chosen.
3) Tomcat appends its own jvmRoute at the end of the session id,
separated with a dot. The session id is send to the client either via
the JSESSIONID cookie, or via URL encoding ("...;jsessionid=...").
4) mod_jk knows about that, extracts the value of the JSESSIONID cookie
presented by the browser respectively extracts the id encoded in the
URL, looks for the separating dot and extracts the jvmRoute from the id.
The load balancing worker then searches for a member worker with the
same name and uses that one for stickyness.
Regards,
Rainer
---------------------------------------------------------------------
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