欢迎来到天天文库
浏览记录
ID:45492975
大小:55.00 KB
页数:7页
时间:2019-11-13
《Apache与tomcat的整合及负载均衡》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、Apache与tomcat的整合及负载均衡系统环境:WindowsServer2008R2SP1虚拟机软件:Hyper-V管理器6.1.7601.17514虚拟机环境:RedHatEnterpriseLinuxServerrelease5.4(Tikanga)X64安装软件版本:JDK:1.6.0_19Tomcat:6.0.20Apache:2.2.19JK:1.2.10实施步骤:一、安装软件。。。1tar-xzvfjdk1.6.0_19.tar.gz2tarxvfztomcat.tar.gz3tarzxvfhttpd-2.2.19.tar.gz4cdhttpd-2.2.195./
2、configure--prefix=/usr/local/apache2--enable-so--enable-mods-shared=most--with-mpm=worker6make7makeinstall8tarzxvfjakarta-tomcat-connectors-1.2.10-src.tar.gz9cdjakarta-tomcat-connectors-1.2.10-src/jk/native/10./buildconf.sh11./configure--with-apxs=/usr/local/apache2/bin/apxs12make13makeinstall
3、二、配置整合及负载均衡1cp/usr/local/jakarta-tomcat-connectors-1.2.10-src/jk/native/apache-2.0/mod_jk.so/usr/local/apache2/modules2配置环境变量vi/etc/profile在文本末尾加入以下内容JAVA_HOME=JDK安装路径CATALINA_HOME=tomcat安装路径CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$CATALINA_HOME/lib/servlet-api.jarPATH=$JAVA
4、_HOME/bin:$PATHexportJAVA_HOMECATALINA_HOMECLASSPATHPATH2应用初始的环境变量source/etc/profile3修改apache的httpd.confvi/usr/local/apache2/conf/httpd.conf修改以下几处并且在末尾加上:Include/usr/local/apache2/conf/mod_jk.conf4添加及设置mod_jk.confvi/usr/local/apache2/mod_jk.conf增加以下内容#加载mod_jkModuleLoadModulejk_modulemodules/m
5、od_jk.so#指定workers.properties文件路径JkWorkersFileconf/workers.propertiesJkLogFilelogs/mod_jk.logJkLogLevelinfo#指定那些请求交给tomcat处理,"controller"为在workers.propertise里指定的负载分配控制制器JkMount/*lb2添加及设置workers.propertiesvi/usr/local/apache2/conf/workers.properties添加以下内容worker.list=lb,tomcat1,tomcat2#server列表#
6、========tomcat1========worker.tomcat1.port=8009#ajp13端口号,在tomcat下server.xml配置,默认8009worker.tomcat1.host=10.1.1.2#tomcat的主机地址,如不为本机,请填写ip地址worker.tomcat1.type=ajp13worker.tomcat1.lbfactor=1#server的加权比重,值越高,分得的请求越多#========tomcat2========worker.tomcat2.port=8009#ajp13端口号,在tomcat下server.xml配置,默认8
7、009worker.tomcat2.host=10.1.1.3#tomcat的主机地址,如不为本机,请填写ip地址worker.tomcat2.type=ajp13worker.tomcat2.lbfactor=1#server的加权比重,值越高,分得的请求越多#========controller,负载均衡控制器========worker.lb.type=lbworker.lb.balanced_workers=tomcat1,tomcat2#指定分担请求的tom
此文档下载收益归作者所有