Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1477697
  • 博文数量: 187
  • 博客积分: 10375
  • 博客等级: 上将
  • 技术积分: 3127
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-07 10:58
文章分类

全部博文(187)

文章存档

2013年(1)

2012年(8)

2011年(28)

2010年(36)

2009年(47)

2008年(67)

我的朋友

分类: LINUX

2011-04-22 09:53:11

If sticky_session is an int and is not 0 it is set to JK_TRUE and sessions are sticky, otherwise sticky_session is set to false

worker.loadbalancer.sticky_session=true
此处指定集群是否需要会话复制,如果设为true,则表明为会话粘性,不进行会话复制,当某用户的请求第一次分发到哪台Tomcat后,后继的请求会一直分发到此Tomcat服务器上处理;如果设为false,则表明需求会话复制。
worker.loadbalancer.sticky_session_force=true
如果上面的sticky_session设为true时,建议此处也设为true,此参数表明如果集群中某台Tomcat服务器在多次请求没有响应后,是否将当前的请求,转发到其它Tomcat服务器上处理;此参数在sticky_session=true时,影响比较大,会导致转发到其它Tomcat服务器上的请求,找不到原来的session,所以如果此时请求中有读取session中某些信息的话,就会导致应用的null异常

Concerning the load balancer worker: you need to set jvmRoute in
server.xml on your Tomcat servers. The value of the respective jvmRoute
has to be wrkr1 and wrkr2.

This will add that string to the session id (JSESSSIONID cookie or
jsessionid= URL part) and mod_jk strips it from there to learn, where
the sticky request should go to.

Regards,

Rainer

Tim Alberts wrote:
> Well I found one problem with my workers.properties, but it didn't fix
> my problem. I used the deprecated 'balanced_workers' on my load
> balancer configuration instead of the balance_workers. So I'm still
> stuck, any suggestions?
>
>
> Tim Alberts wrote:
>> I have two tomcat servers (5.5.23) and running mod_jk (1.2.20) with
>> load balancing behind apache. I have a web application that needs to
>> maintain session information. What I'm seeing is that the load
>> balance is alternating requests between the servers equally, as
>> expected, but sessions are getting lost when going between the
>> servers. I thought from reading that the default is
>> sticky_session=True which means the mod_jk will keep sessions going to
>> the same server (if it is available..). This is obviously not
>> happening. Am I doing something wrong, or is there a problem?
>>
>> # workers.properties - ajp13
>> #
>> # List workers
>> worker.list=lb,jkstatus
>> #
>> # Define wrkr1
>> worker.wrkr1.port=8009
>> worker.wrkr1.host=msi1
>> worker.wrkr1.type=ajp13
>> worker.wrkr1.socket_timeout=300
>> worker.wrkr1.lbfactor=1
>> #
>> # Define wrkr2
>> worker.wrkr2.port=8009
>> worker.wrkr2.host=msi2
>> worker.wrkr2.type=ajp13
>> worker.wrkr2.socket_timeout=300
>> worker.wrkr2.lbfactor=1
>> #
>> # Define lb
>> worker.lb.type=lb
>> worker.lb.sticky_session=True
>> worker.lb.sticky_session_force=False
>> worker.lb.balanced_workers=wrkr1,wrkr2
>> #
>> # Define a 'jkstatus' worker using status
>> worker.jkstatus.type=status
>>
>> Second, I see a reference to a Session Manager in the Tomcat
>> documentation that can maintain session data across multiple servers.
>> This is the first I've heard about this, is this something Tomcat has
>> built in that I need to enable, or is this third party or something I
>> need to write on my own? (I will be reading more, but quick info from
>> users is helpful).
>>
>> Thank you for any help.
阅读(4339) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~