Tomcat6_Apache2.2_ajp负载均衡加集群实战
环境:
--------------------------------------------
一台apache2.2服务器,三台tomcat服务器:
apache2.2服务器
1.ip:192.168.1.20
2.只装apache软件:httpd-2.2.6.tar.bz2
安装路径:/usr/local/apache2
tomcat服务器:均配置相同的应用。
1.集群名:balancer://tomcatcluster
2.三台集群服务器ip:
IP_1:192.168.1.31
IP_2:192.168.1.32
IP_3:192.168.1.33
3.测试应用程序test文件夹放在tomcat6的webapps目录下
操作系统均为:CentOS 4.5_x86
jre:1.6:jdk-6u1-linux-i586-rpm.bin
tomcat6.0:编译好的二进制软件包apache-tomcat-6.0.13.tar.gz
tomcat6.0 安装路径:/usr/local/tomcat6
oralce的jdbc:class12.jar
软件包存放的路径:/home/xiutuo/software/
java安装路径:/usr/java/jdk1.6.0_01
使用普通用户:xiutuo来启动tomcat6
tomcat6开机自动启动脚本:/etc/init.d/tomcat
下载路径:
http://java.sun.com/javase/downloads/index.jsp
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
一:前言:
1.apache对tomcat集群支持有俩种方式:
a.通过apache2.1之后版本后内置的proxy_ajp。
b.对于apache2.1之版本则通过tomcat的jk2.0.4的mod_jk2.so:
(该版本已经停止开发)
将解压缩后的目录中的modules目录中的mod_jk2.so
文件复制到apache的安装目录下的modules目录中。
********************
俩种方式比较:
proxy_ajp配置较简单,主要表现在proxy_ajp目前只支持配置到目录,
还不支持对文件名称的pattern模式匹配
(即还不能定义到只对jsp文件起作用)。
而jk2则可配置性强,但已经停止开发
********************
官方对ajp和jk2说明:
JK2 has been put in maintainer mode and no further development will take place.
The reason for shutting down JK2 development was the lack of developers interest.
Other reason was lack of users interest in adopting JK2,
caused by configuration complexity when compared to JK.
The latest official JK2 release is 2.0.4.
JK2 will have it's successor within core Apache2.1/2.2 distribution.
We have developed new proxy_ajp that is an addition to the mod_proxy
and uses Tomcat's AJP protocol stack. It is developped in httpd-2.1
and integrated in it. We have also developed a new proxy_balancer
module for load balancing http and ajp protocol stacks.
JK will be fully supported for all other web servers.
The next JK release is planned for the end of November.
Lots of code from JK2 has been ported to JK
2.tomcat集群方式:
a.DeltaManager
--现在采用的该方式:内部机器集群少采用
b.BackupManager
********************
两种集群方式官方说明:
using the DeltaManager to replicate session deltas.
By all-to-all we mean that the session gets replicated to
all the other nodes in the cluster. This works great for smaller cluster
but we don't recommend it for larger clusters(a lot of tomcat nodes).
Also when using the delta manager it will replicate to all nodes,
even nodes that don't have the application deployed.
To get around this problem, you'll want to use the BackupManager.
This manager only replicates the session data to one backup node,
and only to nodes that have the application deployed.Downside of
the BackupManager: not quite as battle tested as the delta manager.
********************
3.负载均衡(load-balance)定义:
在服务器端短时间内获得大量的请求,单一服务器无法在一个较短的时间内响应这些请求,
此时服务器需要一个机制,请求按照多个服务器不同的负载能力,把这些请求合理的分配。
4.集群(cluster):
在多个服务器之间共享用户信息,资源等。
tomcat6_apache2.2负载均衡加集群:高可用性至高体现。
现在的带集群功能相关软件Oracle10g,mysql5,tomcat等。
二:软件安装
1.apache服务器安装:
这里主要介绍apache2的源码安装
# cd /home/xiutuo/software/
# tar -zvxf httpd-2.2.6.tar.gz
# cd httpd-2.2.6
# mkdir -p /usr/local/apache2
# ./configure \
--prefix=/usr/local/apache2 \
--enable-modules=so \
--enable-mods-shared=all \
--enable-proxy \
--enable-proxy-connect \
--enable-proxy-ftp \
--enable-proxy-http \
--enable-proxy-ajp \
--enable-proxy-balancer
注释:这里测试用,编译了所有可用模块,并激活了tomcat集群需要的
enable-proxy,enable-proxy-http,enable-proxy-connect,enable-proxy-ajp
和enable-proxy-balancer,其中proxy-ajp和proxy-balancer必须依赖proxy,
如果是自定义的编译除了以上几个必须的模块外,mod_status也要编译进去,切记。
enable-proxy-ftp可以不编译。
# make
# make install
--------------------------------------------
一台apache2.2服务器,三台tomcat服务器:
apache2.2服务器
1.ip:192.168.1.20
2.只装apache软件:httpd-2.2.6.tar.bz2
安装路径:/usr/local/apache2
tomcat服务器:均配置相同的应用。
1.集群名:balancer://tomcatcluster
2.三台集群服务器ip:
IP_1:192.168.1.31
IP_2:192.168.1.32
IP_3:192.168.1.33
3.测试应用程序test文件夹放在tomcat6的webapps目录下
操作系统均为:CentOS 4.5_x86
jre:1.6:jdk-6u1-linux-i586-rpm.bin
tomcat6.0:编译好的二进制软件包apache-tomcat-6.0.13.tar.gz
tomcat6.0 安装路径:/usr/local/tomcat6
oralce的jdbc:class12.jar
软件包存放的路径:/home/xiutuo/software/
java安装路径:/usr/java/jdk1.6.0_01
使用普通用户:xiutuo来启动tomcat6
tomcat6开机自动启动脚本:/etc/init.d/tomcat
下载路径:
http://java.sun.com/javase/downloads/index.jsp
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
一:前言:
1.apache对tomcat集群支持有俩种方式:
a.通过apache2.1之后版本后内置的proxy_ajp。
b.对于apache2.1之版本则通过tomcat的jk2.0.4的mod_jk2.so:
(该版本已经停止开发)
将解压缩后的目录中的modules目录中的mod_jk2.so
文件复制到apache的安装目录下的modules目录中。
********************
俩种方式比较:
proxy_ajp配置较简单,主要表现在proxy_ajp目前只支持配置到目录,
还不支持对文件名称的pattern模式匹配
(即还不能定义到只对jsp文件起作用)。
而jk2则可配置性强,但已经停止开发
********************
官方对ajp和jk2说明:
JK2 has been put in maintainer mode and no further development will take place.
The reason for shutting down JK2 development was the lack of developers interest.
Other reason was lack of users interest in adopting JK2,
caused by configuration complexity when compared to JK.
The latest official JK2 release is 2.0.4.
JK2 will have it's successor within core Apache2.1/2.2 distribution.
We have developed new proxy_ajp that is an addition to the mod_proxy
and uses Tomcat's AJP protocol stack. It is developped in httpd-2.1
and integrated in it. We have also developed a new proxy_balancer
module for load balancing http and ajp protocol stacks.
JK will be fully supported for all other web servers.
The next JK release is planned for the end of November.
Lots of code from JK2 has been ported to JK
2.tomcat集群方式:
a.DeltaManager
--现在采用的该方式:内部机器集群少采用
b.BackupManager
********************
两种集群方式官方说明:
using the DeltaManager to replicate session deltas.
By all-to-all we mean that the session gets replicated to
all the other nodes in the cluster. This works great for smaller cluster
but we don't recommend it for larger clusters(a lot of tomcat nodes).
Also when using the delta manager it will replicate to all nodes,
even nodes that don't have the application deployed.
To get around this problem, you'll want to use the BackupManager.
This manager only replicates the session data to one backup node,
and only to nodes that have the application deployed.Downside of
the BackupManager: not quite as battle tested as the delta manager.
********************
3.负载均衡(load-balance)定义:
在服务器端短时间内获得大量的请求,单一服务器无法在一个较短的时间内响应这些请求,
此时服务器需要一个机制,请求按照多个服务器不同的负载能力,把这些请求合理的分配。
4.集群(cluster):
在多个服务器之间共享用户信息,资源等。
tomcat6_apache2.2负载均衡加集群:高可用性至高体现。
现在的带集群功能相关软件Oracle10g,mysql5,tomcat等。
二:软件安装
1.apache服务器安装:
这里主要介绍apache2的源码安装
# cd /home/xiutuo/software/
# tar -zvxf httpd-2.2.6.tar.gz
# cd httpd-2.2.6
# mkdir -p /usr/local/apache2
# ./configure \
--prefix=/usr/local/apache2 \
--enable-modules=so \
--enable-mods-shared=all \
--enable-proxy \
--enable-proxy-connect \
--enable-proxy-ftp \
--enable-proxy-http \
--enable-proxy-ajp \
--enable-proxy-balancer
注释:这里测试用,编译了所有可用模块,并激活了tomcat集群需要的
enable-proxy,enable-proxy-http,enable-proxy-connect,enable-proxy-ajp
和enable-proxy-balancer,其中proxy-ajp和proxy-balancer必须依赖proxy,
如果是自定义的编译除了以上几个必须的模块外,mod_status也要编译进去,切记。
enable-proxy-ftp可以不编译。
# make
# make install
相关推荐
wanjichun 2020-07-26
魏莉的微 2020-06-07
windzoone 2020-06-01
后厂村老司机 2020-05-08
sushuanglei 2020-11-12
xingyuzhe 2020-09-21
newcome 2020-09-09
XiaoMuFireAnt 2020-09-02
gracecxj 2020-08-25
zyshappy 2020-08-16
我爱熊猫 2020-08-07
luvzhan 2020-07-28
HelloC先生 2020-07-27
clmngu 2020-07-26
shenxiuwen 2020-07-16
枫叶上的雨露 2020-07-04
yang0cs 2020-06-28
bruce 2020-06-28
middleware0 2020-06-27