其中 jvmRoute是用来让apache识别的节点名称,一个节点一个名称。
同理编辑192.168.1.2的jboss/server/default/deploy/boss-web.deployer/server.xml文件,注意
把 jvmRoute设置为node2,
可以设置成别的只要和192.168.1.1的不重复就行,但是要和Apache workers.properties保持一致 c.编辑jboss/server/default/deploy/jboss-web.deployer/ROOT.war/WEB-INF/web.xml
在节点下增加如下代码: d.编辑jboss/server/default/deploy/jboss-web.deployer/META-INF/jboss-service.xml 文件
把 false
改为:true
这样的话就会使用粘稠session,这样可以保证用户的所有请求都在同一台服务器上 2.配置apache
说明:我们使用apache的mod_jk来做jboss的web集群,浏览器请求apache服务器,apache服务器根据
workers.properties中的配置 进行request分发,apache服务器和JBoss中的Tomcat可以用ajp1.3进行
通信的,request通过ajp1.3协议的包装被发送到JBoss,JBoss执行后返回结果。 a.在apache\conf\目录下 新建mod-jk.conf文件并添加如下内容:
# Load mod_jk module
# Specify the filename of the mod_jk lib
LoadModule jk_module modules/mod_jk-apache-2.0.59.so
# Where to find 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 debug
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
# JkOptions indicates to send SSK KEY> JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat
JkRequestLogFormat "%w %V %T"
# Mount your applications
#JkMount /application/* 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
# Add shared memory.
# This directive is present with 1.2.10 and
# later versions of mod_jk, and is needed for
# for load balancing to work properly
JkShmFile logs/jk.shm
# Add jkstatus for managing runtime data
JkMount status
Order deny,allow
Deny from all
Allow from 127.0.0.1