apache+tomcat集群02 AJP代理模式

 

上一篇(apache+tomcat集群01 HTTP代理模式),我说了通过Http代理模式实现Tomcat集群,今天我们来简单把AJP方式实现集群的方式介绍一下,其实和Http代理模式很类似,废话少说

 

1、加载module

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_http_module modules/mod_proxy_http.so

LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

 

2、继续添加如下配置:

ProxyPass / balancer://loadbalancer/
ProxyPassReverse / balancer://loadbalancer/
<Proxy balancer://loadbalancer/>
BalancerMember ajp://localhost:8019/
BalancerMember ajp://localhost:8029/
BalancerMember ajp://localhost:8039/
</Proxy>

 

以上与Http修改主要集中在

1、  修改BalancerMember中的httpajp

2、  注意这里的801980298039,是Tomcat server.xml中的port

   <Connector port="8019" protocol="AJP/1.3" redirectPort="8443" />

如果我们这里直接写成Tomcat的端口会报:

[Fri Aug 02 18:28:38 2013] [error] ajp_read_header: ajp_ilink_receive failed
[Fri Aug 02 18:28:38 2013] [error] (120006)APR does not understand this error code: proxy: read response failed from (null) (localhost)
[Fri Aug 02 18:28:46 2013] [error] (70014)End of file found: ajp_ilink_receive() can't receive header
[Fri Aug 02 18:28:46 2013] [error] ajp_read_header: ajp_ilink_receive failed
[Fri Aug 02 18:28:46 2013] [error] (120006)APR does not understand this error code: proxy: read response failed from (null) (localhost)

 

3、配置Tomcat容器

         参见:tomcat集群中实现Session共享

 

测试:

         参见:apache+tomcat集群01 HTTP代理模式

你可能感兴趣的:(apache,tomcat,集群,ajp)