在apache的conf下建立文件workers.properties
workers.properties 指定tomcat服务器
worker.list=fuzaij,tomcat1,tomcat2
worker.tomcat1.port=8019
worker.tomcat1.host=localhost
worker.tomcat1.type=ajp13
worker.tomcat1.lbfactor=1
worker.tomcat2.port=8029
worker.tomcat2.host=localhost
worker.tomcat2.type=ajp13
worker.tomcat2.lbfactor=1
worker.fuzaij.type=lb
worker.fuzaij.balance_workers=tomcat1,tomcat2
worker.fuzaij.sticky_session=1
apache配置
<IfModule mpm_prefork_module>
ServerLimit 3000
StartServers 750
MinSpareServers 5
MaxSpareServers 100
MaxClients 3000
MaxRequestsPerChild 10000
</IfModule>
LoadModule jk_module modules/mod_jk-1.2.30-httpd-2.0.53.so(要下载至modules目录下)
JkWorkersFile conf/workers.properties
JkLogFile "D:/server/tomcat620/tomcat9091/mod_jk2.log"
JkLogLevel debug
<VirtualHost *:8080>
ServerAdmin localhost
DocumentRoot E:/technique/zc/modeltwosimple/webroot/apache
DirectoryIndex index.html index.html.var index.jsp
ServerName localhost:8080/modeltwo
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
JkMount /*.jsp fuzaij
JkMount /*.do fuzaij
</VirtualHost>
tomcat配置
<Connector port="8029" protocol="AJP/1.3" redirectPort="8983" />
如果不想实现粘性session, jvmRoute可以不配置
<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat2" >
如果不想实现session复制, Cluster元素可以不添加
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
tomcat的session同步功能需要用到组播,windows默认情况下是开通组播服务的,但是linux默认情况下并没有开通,可以通过指令打开route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0,如果需要服务器启动时即开通组播需在/etc/sysconfig/static-routes文件内加入eht0 net 224.0.0.0 netmask 240.0.0.0。
http://www.iteye.com/topic/566051