本例的环境是CentOS 6.4 64位,JDK 7,apache httpd是系统自带的
使用apache作为前端,使用jk连接。然后以Session复制的方式实现
三台机器:172.16.1.9(apache.server),172.16.1.100(appserver1),172.16.1.101(appserver2),第一台是apache服务器,后面两台是ofbiz服务器。
第一步:在 apache.server上装好apache及jk。jk可以在网上下载,我的是 mod_jk-1.2.31-httpd-2.2.x.so,下载下来后复制到modules文件夹,重命名为mod_jk.so,在httpd.conf中加上
LoadModule jk_module modules/mod_jk.so
因为是需要在根目录上做跳转所以在httpd.conf的末尾加上
<Location />
JkMount controller
Order Allow,Deny
Allow from all
</Location>
第二步:增加mod_js.conf配置文件,内容如下
JkWorkersFile /etc/httpd/conf.d/workers.properties
JkLogFile logs/mod_jk.log
JkMount /*.jsp controller
JkMount /control controller
JkMount /control/* controller
JkMount /js/* controller
JkMount /css/* controller
JkMount /image/* controller
JkMount /*.html controller
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
worker.list=controller
#-----AppServer1
worker.appserver1.port=8009
worker.appserver1.host=172.16.1.100
worker.appserver1.type=ajp13
worker.appserver1.lbfactor = 1
#-----AppServer2
worker.appserver2.port=8009
worker.appserver2.host=172.16.1.101
worker.appserver2.type=ajp13
worker.appserver2.lbfactor = 1
worker.controller.type=lb
worker.controller.balanced_workers=appserver1,appserver2
worker.controller.sticky_session=False
具体参数的意思就不解释了,网上的资料上都有
第四步:修改%OFBIZ%/framework/base/config/ofbiz-container.xml文件
第五步:在各模块的web.xml文件中加上<distributable/>,注意上图中提到的端口,如8009,4001,45564等端口都要在iptables中配置好
转载于:https://my.oschina.net/mogralee/blog/165568