日期:2014-05-16  浏览次数:20999 次

采用ajp代理模式配置Apache+tomcat实现负载均衡

这一种方法,配置简单,性能也高。附AJP介绍:

apache-tomcat-7.0.35-windows-i64.zip

apache 必须是2.2.x以上版本

????? AJP是Apache提供的完成与其它服务器通讯的一种协议。在Apache中通过mod_proxy_ajp模块发送AJP数据,另外一端的服务器需要实现AJP协议,能够接受mod_proxy_ajp模块发送的AJP协议数据,在接受到AJP协议数据后做适当处理,并能够将处理结果以AJP协议方式发送回给mod_proxy_ajp模块。

?????? 当使用单独的服务器,在Tomcat实例前端使用本地的Web服务器时,性能要比单独使用Tomcat及其默认的HTTP连接糟得多,即使web应用程序本身相当一部分是由静态文件构成。如果需要将Tomcat同本地的Web服务器集成,AJP连接优于代理HTTP,将提供更好的性能。从Tomcat角度来看,AJP是最有效的。它同时具有HTTP相同的功能(When using a single server, the performance when using a native webserver in front of the Tomcat instance is most of the time significantly worse than a standalone Tomcat with its default HTTP connector, even if a large part of the web application is made of static files. If integration with the native webserver is needed for any reason, an AJP connector will provide faster performance than proxied HTTP. AJP clustering is the most efficient from the Tomcat perspective. It is otherwise functionally equivalent to HTTP clustering.)

???使用这种协议,具有更高的性能,因为它采用的是二进制传输。比HTTP的文本传输要有更高的效率。在Apache中要使用mod_proxy和mod_proxy_ajp,在Tomcat中则要开启ajp服务。

?一、前期准备工作:安装用的程序(前提保证已安装了JDK1.5以上的版本)?
APAHCE 2.2.4

TOMCAT6.0
二、安装过程?
APAHCE
安装目录:D:\Apache Group\Apache2?
l两个TOMCAT目录:自行解压到(D:\Apache Group\集群服务器\)下。分别为?tomcat6_1