现在的位置: 首页 > 综合 > 正文

apache + jboss集群配置

2013年10月12日 ⁄ 综合 ⁄ 共 2046字 ⁄ 字号 评论关闭
使用环境:apache_2.0.55,jboss4.0.4
分别下载apache_2.0.55-win32-x86-no_ssl.msi,mod_jk-apache-2.0.55.so,jboss-4.0.4.GA.zip

配置主要步骤

一、配置apache
   1.修改%apache%/conf/httpd.conf的末尾加    Include conf/mod_jk.conf
    2.在%apache%/conf下面新建文件mod_jk.conf ,内容如下:
#加载mod_jk Module
#LoadModule jk_module modules/mod_jk.so
LoadModule jk_module modules/mod_jk-apache-2.0.55.so
#指定 workers.properties文件路径
JkWorkersFile conf/workers.properties
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# Mount your applications
#JkMount /application/* loadbalancer
JkMount /* loadbalancer
#JkMount /*.* loadbalancer
# You can use external file for mount points.
# It will be checked for updates each 60 seconds.
# The format of the file is: /url=worker
# /examples/*=loadbalancer
JkMountFile conf/uriworkermap.properties
JkShmFile logs/jk.shm
# Add jkstatus for managing runtime data
其中JkMount /* loadbalancer的意思是,把所有的请求都发给loadbalancer处理。可以通过修改url来控制发送某些request。

   3.在%apache%/conf下新建文件    workers.properties        其内容为:
# Define list of workers that will be used
# for mapping requests
worker.list=loadbalancer,status
# Define Node1
# modify the host as your host IP or DNS name.
worker.node1.port=8099
worker.node1.host=localhost
worker.node1.type=ajp13
worker.node1.lbfactor=1
worker.node1.local_worker=1
worker.node1.cachesize=10
# Define Node2
# modify the host as your host IP or DNS name.
worker.node2.port=8009
worker.node2.host= 192.168.130.99
worker.node2.type=ajp13
worker.node2.lbfactor=0
# Define Node3
# modify the host as your host IP or DNS name.
worker.node3.port=8009
worker.node3.host= 192.168.130.112
worker.node3.type=ajp13
worker.node3.lbfactor=1
# Load-balancing behaviour
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=node1
#,node2,node3
worker.loadbalancer.sticky_session=1
#worker.list=loadbalancer
# Status worker for managing load balancer
worker.status.type=status

二、配置jboss

修改/jbossweb-tomcat55.sar/META-INF/jboss-service.xml
找到UseJK,改为true.

修改/jbossweb-tomcat55.sarserver.xml
修改应用下面的web.xml
增加jboss-web.xml

抱歉!评论已关闭.