tar zxvf tomcat-connectors-1.2.28-src.tar.gz
cd tomcat-connectors-1.2.28-src/native
./configure --with-apxs=/usr/local/apache/bin/apxs --with-java-home=/usr/local/jdk
make ; make install
在/usr/local/apache/modules/ 下会产生mod_jk.so文件,然后修改apache配置文件:
vi /usr/local/apache/conf/httpd.conf
------------------------------------------------------------------------------------------------
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkShmFile logs/mod_jk.shm
JkLogFile logs/mod_jk.log
JkLogLevel info
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkMount /* controller
JkUnMount /*.htm controller
jkUnMount /*.html controller
------------------------------------------------------------------------------------------------
更改DocumentRoot 为tomcat的部署目录
建立JK配置文件:
vi /usr/local/apache/conf/workers.properties
------------------------------------------------------------------------------------------------
workers.java_home=/usr/local/jdk
ps=/
worker.list=controller
worker.tomcat1.port=端口号
worker.tomcat1.host=IP地址
worker.tomcat1.type=ajp13
worker.tomcat1.lbfactor=1
worker.tomcat2.port=端口号
worker.tomcat2.host=IP地址
worker.tomcat2.type=ajp13
worker.tomcat2.lbfactor=1
worker.controller.type=lb
worker.controller.balance_workers=tomcat1,tomcat2
worker.controller.sticky_session=1
------------------------------------------------------------------------------------------------
修改web应用里面WEB-INF目录下的web.xml文件,加入标签
<distributable/>
直接加在</web-app>之前就可以了
做tomcat集群必须需要这一步,否则用户的session就无法正常使用。
声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。