Tomcat集群的配置:
1.       下载tomcat的软件包:下载解压版本
Binary Distributions
·         Core:
o    zip ( pgp , md5 )
下载地址:
http://apache.freelamp.com/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.zip
 
解压tomcat c盘根目录,重命名为tomcat1,然后复制tomcat1tomcat2.
 
windows 上实现Apache 负载均衡 +tomcat群集 (二)_第1张图片
修改 server.xml 配置文件
 
Tomcat1 中修改的部分:
1.9005" shutdown="SHUTDOWN">
 
 
 2. 9080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
 
1.       9009" protocol="AJP/1.3" redirectPort="8443" />
 
 
4.   appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
----------------------------------- 添加的部分 -----------------------------------
添加在 之间
  channelSendOptions="6">
expireSessionsOnShutdown="false"
notifyListenersOnReplication="true"
mapSendOptions="6"/>
 
address="224.0.0.1"
port="45564"
frequency="500"
dropTime="3000"/>
address="auto"
port=" 5001 "
selectorTimeout="100"
maxThreads="6"/>
filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
 
     
 
 
Tomcat2 中修改的部分:
1.10005" shutdown="SHUTDOWN">
 
2 10080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
 
3.10009" protocol="AJP/1.3" redirectPort="8443" />
 
4.  添加在 之间
 
  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
  channelSendOptions="6">
expireSessionsOnShutdown="false"
notifyListenersOnReplication="true"
mapSendOptions="6"/>
address="228.0.0.4"
port="45564"
frequency="500"
dropTime="3000"/>
address="auto"
port="5002"
selectorTimeout="100"
maxThreads="6"/>
filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
 
 
集群测试
2 tomcat 里面添加网页
 
 
Tomcat1 上的 \webapps\ROOT\index.html 内容如下:
Tomcat </span> <span style="font-family: 宋体; mso-ascii-font-family: calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: calibri; mso-hansi-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast">群集</span> <span>1
Tomcat 1 号机在 tomcatA 机上
 
Tomcat2 上的 webapps\ROOT\index.html 内容如下:
Tomcat<span style="mso-spacerun: yes">  </span></span> <span style="font-family: 宋体; mso-ascii-font-family: calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: calibri; mso-hansi-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast">群集</span> <span>2
Tomcat 2 号机在 TomcatB 机上
 
 
启动 Tomcat1 Tomcat2 ,再启动 Apache
windows 上实现Apache 负载均衡 +tomcat群集 (二)_第2张图片
windows 上实现Apache 负载均衡 +tomcat群集 (二)_第3张图片