我想在Apache mod_jk模块中使用负载均衡。我已经安装了Apache 2.2和相应的mod_jk模块。另外我正在运行Tomcat 7实例。我在Tomcat上运行的应用程序在隐藏的表单字段中生成一个session-id,如下例所示:
<input name="USERID" type="hidden" value="o8b651zQOY1A1Hvl" id="USERID">
这是我的httpd.conf:
# all servlets and jsp to balance1
JkMount /*.jsp balance1
my workers.properties:
worker.list=jkstatus,balance1
# The load balancer worker balance1 will distribute
# load to the members worker1 and worker2
worker.balance1.type=lb
worker.balance1.balance_workers=worker1, worker2
worker.balance1.sticky_session=true
worker.balance1.sticky_session_force=true
#worker1
worker.worker1.type=ajp13
worker.worker1.host=demoappsrv1
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.session_cookie=USERID
#worker2
worker.worker2.type=ajp13
worker.worker2.host=demoappsrv2
worker.worker2.port=8009
worker.worker2.lbfactor=50
worker.worker2.session_cookie=USERID
来自第一个Tomcat实例的server.xml:
<Engine name="Catalina" defaultHost="localhost" jvmRoute="worker1">
我的第二个Tomcat实例的server.xml:
<Engine name="Catalina" defaultHost="localhost" jvmRoute="worker2">
使用此配置,粘性会话无效。任何想法都将不胜感激。
提前致谢!
答案 0 :(得分:-2)
在表单中包含隐藏字段不会自动创建cookie。