日期:2014-05-16  浏览次数:20711 次

tomcat集群无法完成session共享
我想实现apache(2.2.6)与2个tomcat(6.0.18)的集群。按照网上的方法,我实现了负载平衡,但不能完成session复制。有那位能帮我一下嘛?以下是配置文件的代码。

httpd.conf
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkMountFile conf/uriworkmap.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"

#JkMount /jkstate mystatus
#JkMount /*.jsp balance


workers.properties
#workers.java_home=C:\Program Files\Java\jdk1.6.0_03
ps=\
worker.list=balance,mystatus

worker.tomcat1.type=ajp13
worker.tomcat1.host=localhost
worker.tomcat1.port=8009
worker.tomcat1.lbfactor=1
worker.tomcat1.socket_timeout=30

worker.tomcat2.type=ajp13
worker.tomcat2.host=localhost
worker.tomcat2.port=9009
worker.tomcat2.lbfactor=1
worker.tomcat2.socket_timeout=30

worker.balance.type=lb
#worker.balance.session_cookie=JSESSIONID
#worker.balance.session_path=;jsessionid
worker.balance.balance_workers=tomcat1,tomcat2
worker.balance.sticky_session=1


worker.mystatus.type=status


uriworkmap.properties
/jkstate=mystatus
/*.jsp=balance


------解决方案--------------------
继续。

tomcat1---server.xml
<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 -->
<Server port="8005" shutdown="SHUTDOWN">

  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation