windows下tomcat的集群
# Example:
LoadModule jk_module modules/mod_jk.so
#
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkMount /jsp-examples/*.* machine
2.在workers.properties文件中加入以下内容
worker.list=machine
worker.tomcat1.port=8009
worker.tomcat1.host=192.168.0.21
worker.tomcat1.type=ajp13
worker.tomcat1.lbfactor=10
worker.tomcat2.port=8010
worker.tomcat2.host=192.168.0.21
worker.tomcat2.type=ajp13
worker.tomcat2.lbfactor=10
worker.tomcat3.port=8011
worker.tomcat3.host=192.168.0.21
worker.tomcat3.type=ajp13
worker.tomcat3.lbfactor=10
worker.machine.type=lb
worker.machine.balance_workers=tomcat1,tomcat2,tomcat3
3.在tomcat的server.xml文件中添加以下内容
1.修改Server端口。<Server port="8005" shutdown="SHUTDOWN">
2.注释默认的连接的端口( <Connector port="8080")
<!-- --> Define a non-SSL HTTP/1.1 Connector on port 8080
<Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
3.修改jk端口(要和workers.properties中的端口号中对应) <Connector port="8009" enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
4.添加jvmRoute="tomcat1"(要和workers.properties中的对应)
<Engine name="Standalone" defaultHost="localhost" jvmRoute="tomcat1">
5.注释<Engine name="Catalina"
<!-- --> Define the top level container in our container hierarchy
<Engine name="Catalina" defaultHost="localhost">
4.在tomcat的bin目录下修改service.bat文件中的
set SERVICE_NAME=Tomcat52
set PR_DISPLAYNAME=Apache Tomcat(Tomcat52)