【原创】ApacheTomcat集群在Linux下的搭建步骤

在RedHat5(以下简称RH)上搭建ApacheTomcat的集群环境,有以下步骤:

1.首先安装apr和apr-util

    apr-util需要依赖于apr包,所以先安装apr,

http://files.cnblogs.com/zhangxsh/apr-util-1.5.3.tar.gz.rar

http://files.cnblogs.com/zhangxsh/apr-1.5.0.tar.gz.rar

 

2.安装pcre

http://files.cnblogs.com/zhangxsh/pcre-8.32.tar.gz.rar

3.安装httpd

http://files.cnblogs.com/zhangxsh/httpd-2.4.7.tar.gz.rar

--------------------------------------

 

[root@localhost httpd-2.4.7]# ./configure --prefix=/apache --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre

 

[root@localhost httpd-2.4.7]#make

 

[root@localhost httpd-2.4.7]#make install

安装完后,还要安装jk:

 http://files.cnblogs.com/zhangxsh/tomcat-connectors-1.2.37-src.tar.gz.rar

tomcat-connectors-1.2.37-src\tomcat-connectors-1.2.37-src\native\apache-2.0:

 

./configure --with

 

make

 

make install
----------------------------------------
====================================
1.配置apache/conf/httpd.conf,指定jk的配置路径以及负载均衡的tomcat的配置等等
------------------------------------------------------
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkMountFile conf/uriworkermap.properties
JkLogFile logs/mod_jk.log
JkLogLevel warn
-------------------------------------------------------
2.配置
-------------------------------------------------------
[root@localhost conf]# vi workers.properties
 
#
# workers.properties
#
 
 
# list the workers by name
 
worker.list=DLOG4J, status --配置当前由哪些组件提供服务
 
--配置集群中有哪些tomcat组成,配置ajp协议的端口以及tomcat的ip地址
# localhost server 1
# ------------------------
worker.s1.port=8010
worker.s1.host=172.20.70.20
worker.s1.type=ajp13
 
# localhost server 2
# ------------------------
worker.s2.port=8011
worker.s2.host=172.20.70.20
worker.s2.type=ajp13
#worker.s2.stopped=1
 
------配置DLOG4J的工作方式为lb,也就是负载均衡
worker.DLOG4J.type=lb
worker.retries=3
--配置负载均衡下面有哪些tomcat做lb
worker.DLOG4J.balanced_workers=s1, s2
worker.DLOG4J.sticky_session=1
 
worker.status.type=status
-------------------------------------------------------
===========================================
3.apachectl -k -start启动即可

 

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