1,安装apache2,到c:\apache2,
2,下载mod_jk.dll,复制到c:\apache2\modules
3,修改c:\apache2\conf\httpd.conf,添加
LoadModule jk_module modules/mod_jk_2.0.47.dll
JkWorkersFile "C:/Apache2/conf/workers2.properties"
JkMount /*.jsp loadbalancer
JkMount /*.do loadbalancer
JkMount /servlet/* loadbalancer
JkLogFile "c:/Apache2/logs/mod_jk2.log"
JkLogLevel INFO
4,在c:\apache2\conf目录下建立worker2.properties内容
ps=/
worker.list=tomcat1,tomcat2,loadbalancer
worker.tomcat1.port=11009
worker.tomcat1.host=10.1.19.80
worker.tomcat1.type=ajp13
#worker.tomcat1.cachesize
worker.tomcat1.lbfactor=100
worker.tomcat2.port=12009
worker.tomcat2.host=10.1.19.80
worker.tomcat2.type=ajp13
#worker.tomcat2.cachesize
worker.tomcat2.lbfactor=100
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=tomcat1, tomcat2
5,下载tomcat5.5.5的zip版,分别解压缩到c:\tomcat1 ,c:\tomcat2
修改c:\tomcat1\conf\jk2.properties
channelSocket.port=11009
修改c:\tomcat2\conf\jk2.properties
channelSocket.port=12009
6,修改c:\tomcat1\conf\server.xml
(1)<Server port="11005" shutdown="SHUTDOWN">
(2)<Connector port="11080"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
(3)<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat1">
(4)去掉cluster的注释
在该tcpListenPort为4001
7,修改c:\tomcat2\conf\server.xml
(1)<Server port="12005" shutdown="SHUTDOWN">
(2)<Connector port="12080"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
(3)<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat2">
(4)去掉cluster的注释
在该tcpListenPort为4002
8,c:\tomcat1\bin\startup.bat 第一行加入set TOMCAT_HOME=c:\tomcat1
c:\tomcat2\bin\startup.bat 第一行加入set TOMCAT_HOME=c:\tomcat2
9,启动apache2,两个tomcat,OK