环境 :
-
[root@JUN bin]# uname -a
-
Linux JUN 2.6.32-573.el6.x86_64 #1 SMP Thu Jul 23 15:44:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
-
[root@JUN bin]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:75:66:34
inet addr:192.168.125.128 Bcast:192.168.125.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe75:6634/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:51482 errors:0 dropped:0 overruns:0 frame:0
TX packets:44049 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8398647 (8.0 MiB) TX bytes:16283801 (15.5 MiB)
eth0:0 Link encap:Ethernet HWaddr 00:0C:29:75:66:34
inet addr:192.168.125.133 Bcast:192.168.125.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
apache
-
[root@JUN bin]# ./httpd -version
-
Server version: Apache/2.4.17 (Unix)
-
Server built: Oct 22 2015 14:17:02
jboss
-
JBoss 5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221634)
jk :tomcat-connectors-1.2.41-src.tar.gz
前期准备
1. apache 使用运行zabbix 的(未重新安装)
2. jboss 部署两个 , AJP 端口分别为 8009 、8109,打开server.xml access日志 ,用以查看请求访问情况
注:此版本jboss 端口修改 主要是以下两个文件
1) server/default/deploy/jbossweb.sar/server.xml
2) server/default/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml
JK配置
1. 解压 tomcat-connectors-1.2.41-src.tar.gz
2. 编译生成mo_jk.so ,如果apache/modules 目录没有生成mod_jk.so ,可以从
tomcat-connectors-1.2.41-src/native/apache-2.0拷贝过去
-
tar -zxvf 解压 tomcat-connectors-1.2.41-src.tar.gz
-
cd tomcat-connectors-1.2.41-src/native
-
./configure --with-apxs=/usr/local/apache/bin/apxs
-
make && make install
-
[root@JUN modules]# ll mod_jk.so
-rwxr-xr-x 1 root root 1143282 Oct 29 15:55 mod_jk.so
3. copy jk配置文件
-
cp tomcat-connectors-1.2.41-src/conf/* /usr/local/apache/conf
修改相关配置如下:
workers.properties
-
[root@JUN conf]# egrep -v '^#|^$' workers.properties
-
worker.list=jk-status
-
worker.jk-status.type=status
-
worker.jk-status.read_only=true
-
worker.list=jk-manager
-
worker.jk-manager.type=status
-
worker.list=balancer
-
worker.balancer.type=lb
-
worker.balancer.error_escalation_time=0
-
worker.balancer.max_reply_timeouts=10
-
worker.balancer.balance_workers=node1
-
#此处为属性继承
-
worker.node1.reference=worker.template
-
worker.node1.host=192.168.125.128
-
worker.node1.port=8009
-
worker.node1.activation=A
-
worker.balancer.balance_workers=node2
-
worker.node2.reference=worker.template
-
worker.node2.host=192.168.125.133
-
worker.node2.port=8109
-
worker.node2.activation=A
-
worker.template.type=ajp13
-
worker.template.socket_connect_timeout=5000
-
worker.template.socket_keepalive=true
-
worker.template.ping_mode=A
-
worker.template.ping_timeout=10000
-
worker.template.connection_pool_minsize=0
-
worker.template.connection_pool_timeout=600
-
worker.template.reply_timeout=300000
-
worker.template.recovery_options=3
uriworkermap.properties
-
[root@JUN conf]# egrep -v '^#|^$' uriworkermap.properties
-
/admin/*=balancer
-
/manager/*=balancer
-
/*=balancer
-
##此处zabbix相关请求不做分发
-
!/zabbix/*=balancer
-
/jk-manager=jk-manager
-
/jk-status=jk-status
httpd-jk.conf
-
[root@JUN conf]# egrep -v '^#|^$|^ #' httpd-jk.conf
-
LoadModule jk_module modules/mod_jk.so
-
<IfModule jk_module>
-
JkWorkersFile conf/workers.properties
-
JkLogFile logs/mod_jk.log
-
JkLogLevel info
-
JkShmFile logs/mod_jk.shm
-
JkWatchdogInterval 60
-
<Location /jk-status>
-
# Inside Location we can omit the URL in JkMount
-
JkMount jk-status
-
Order deny,allow
-
Deny from all
-
Allow from 172.26.1.54
-
</Location>
-
<Location /jk-manager>
-
# Inside Location we can omit the URL in JkMount
-
JkMount jk-manager
-
Order deny,allow
-
Deny from all
-
Allow from 172.26.1.54
-
</Location>
-
JkMountFile conf/uriworkermap.properties
-
</IfModule>
httpd.conf Include 部分添加 Include conf/httpd-jk.conf
最后启动apache 、jboss 测试
阅读(1377) | 评论(0) | 转发(0) |