日期:2014-05-17  浏览次数:20729 次

apache与tomcat负载集群集成方法有3种jk、jk_proxy、http_proxy


apache与tomcat负载集群集成方法有3种jk、jk_proxy、http_proxy
本次集成使用的软件版本:

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> -->apache:httpd-2.2.17-win32-x86-no_ssl.msi
tomcat:apache
-tomcat-6.0.20.zip
jdk:jdk
-6u14-windows-i586.exe


本次测试是1个apache集成两个tomcat。
安装apache http server省略,访问地址为http://127.0.0.1:8081
安装tomcat,解压apache-tomcat-6.0.20.zip,测试时我是把两个tomcat分开放在不同的虚拟机,其中一个是和apache同一台虚拟机。
两个tomcat分别命名为worker2和worker3
先说tomcat.worker2的配置:
server.xml
(1)配置http监听端口,这里端口设为8079,该步骤非必要,只要不冲突就行了。

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><Connector?port="8079"?protocol="HTTP/1.1"?connectionTimeout="20000"?redirectPort="8443"?/>


(2)配置AJP监听端口,这里端口设为8077,该步骤非必要,只要不冲突就行了。

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><Connector?port="8077"?protocol="AJP/1.3"?redirectPort="8443"?/>


(3)配置服务器标识,这里标识名配置为:worker2,添加jvmRoute="worker2",该步骤必须。

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><Eng