tomcat6_apache2.2_ajp负载均衡加集群

上传人:飞*** 文档编号:4926376 上传时间:2017-08-27 格式:DOC 页数:10 大小:79KB
返回 下载 相关 举报
tomcat6_apache2.2_ajp负载均衡加集群_第1页
第1页 / 共10页
tomcat6_apache2.2_ajp负载均衡加集群_第2页
第2页 / 共10页
tomcat6_apache2.2_ajp负载均衡加集群_第3页
第3页 / 共10页
tomcat6_apache2.2_ajp负载均衡加集群_第4页
第4页 / 共10页
tomcat6_apache2.2_ajp负载均衡加集群_第5页
第5页 / 共10页
点击查看更多>>
资源描述

《tomcat6_apache2.2_ajp负载均衡加集群》由会员分享,可在线阅读,更多相关《tomcat6_apache2.2_ajp负载均衡加集群(10页珍藏版)》请在金锄头文库上搜索。

1、tomcat6_apache2.2_ajp 负载均衡加集群实战 环境:-一台 apache2.2 服务器,三台 tomcat 服务器:apache2.2 服务器1.ip:192.168.1.202.只装 apache 软件:httpd-2.2.6.tar.bz2安装路径:/usr/local/apache2tomcat 服务器:均配置相同的应用。1.集群名:balancer:/tomcatcluster2.三台集群服务器 ip:IP_1:192.168.1.31IP_2:192.168.1.32IP_3:192.168.1.333.测试应用程序 test 文件夹放在 tomcat6 的 web

2、apps 目录下操作系统均为:centos 4.5_x86jre: 1.6:jdk-6u1-linux-i586-rpm.bintomcat6.0:编译好的二进制软件包 apache-tomcat-6.0.13.tar.gztomcat6.0 安装路径:/usr/local/tomcat6oralce 的 jdbc:class12.jar软件包存放的路径:/home/xiutuo/software/java 安装路径:/usr/java/jdk1.6.0_01使用普通用户:xiutuo 来启动 tomcat6tomcat6 开机自动启动脚本:/etc/init.d/tomcat下载路径:htt

3、p:/ 对 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 则可配置性强,但已

4、经停止开发*官方对 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 l

5、atest official JK2 release is 2.0.4.JK2 will have its successor within core Apache2.1/2.2 distribution. We have developed new proxy_ajp that is an addition to the mod_proxyand uses Tomcats AJP protocol stack. It is developped in httpd-2.1 and integrated in it. We have also developed a new proxy_bala

6、ncer 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 JK2.tomcat 集群方式:a.DeltaManager-现在采用的该方式:内部机器集群少采用b.BackupManager*两种集群方式官方说明:using the Del

7、taManager 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 clusterbut we dont recommend it for larger clusters(a lot of tomcat nodes). Also when using the delta manager it will replicate to all node

8、s,even nodes that dont have the application deployed.To get around this problem, youll 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 th

9、e delta manager. *3.负载均衡(load-balance)定义:在服务器端短时间内获得大量的请求,单一服务器无法在一个较短的时间内响应这些请求, 此时服务器需要一个机制,请求按照多个服务器不同的负载能力,把这些请求合理的分配。4.集群(cluster):在多个服务器之间共享用户信息,资源等。tomcat6_apache2.2 负载均衡加集群:高可用性至高体现。现在的带集群功能相关软件 oracle10g,mysql5 ,tomcat 等。二:软件安装1.apache 服务器安装:这里主要介绍 apache2 的源码安装# cd /home/xiutuo/software/ #

10、 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注释:这里测试用,编译了所有可用模块,并激活了 tomca

11、t 集群需要的 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 install2. 三台 tomcat 服务器安装主要介绍 jdk1.6u1 和 tomcat6 的安装,三台机器重复此工作就可以了,当然记得 ip 一定

12、要设置正确。jdk1.6 安装-a.卸载系统自带 jdk# rpm -e j2sdk-1.4.1-fcsb.安装新 jdk# cd /home/xiutuo/software进入软件包存放目录# chmod a+x jdk-6u1-linux-i586-rpm.bin使它有执行权限# ./jdk-6u1-linux-i586-rpm.bin多敲几个空格,然后看到yes的时候输入 yes,回车然后在当前目录下就生成了 jdk-6u1-linux-i586-rpm# rpm -ivh jdk-6u1-linux-i586-rpmc.设置环境变量 仅设置某个用户而不是所有用户可以修改/.cshrc,

13、/.bash_profile 文件,追加下面一段,如果为所有用户以及以后添加的用户都加上环境变量的话,追加/etc/profie 文件. *主意不要在 profile 和/.cshrc 或/.bash_profile 中重复追加 *这里:# vi /etc/profile /java /如果你安装的 j2sdk 的路径不一样,请自行修改JAVA_HOME=/usr/java/jdk1.6.0_01 export JAVA_HOME CLASSPATH=/usr/java/jdk1.6.0_01/lib:/usr/java/jdk1.6.0_01/jre/lib export CLASSPATH

14、 PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin export PATH JRE=/usr/java/jdk1.6.0_01/jre export JREd:立即生效 /如果你修改的是/etc/profile # source /etc/profile /如果你修改的是/.cshrc # source /.cshrc /如果你修改的是/.bash_profile # source /.bash_profile e:测试成功否 # java -versionJava(TM) SE Runtime Environment (build 1.6.0_01-b06)Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)看到这个消息,就 ok 啦-tomcat6 安装tomcat6 更详细的安装请看 blog 上 tomcat 文章-a.安装 tomcat,# cd /home/xiutuo/software /进入软件包存放目录# tar -zvxf apache-tomcat-6.0.13.tar.gz /解压# mv apache-tomcat-6.0.13 /usr/local/tomcat6 /安装# cd /usr/loca

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 研究报告 > 综合/其它

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号