2015年10月5日星期一

EAP_040:安装与配置 mod_cluster

环境:RHEL 6.6 + EWS Httpd 2.1.0

说明,这里安装的是JBoss EAP 6.4.0 自带的mod_cluster,不是从Apache 社区下载的mod_cluster。

1. 访问 access.redhat.com,找到JBoss EAP 6.4.0
(1)检查操作系统环境:
# uname -r
2.6.32-504.el6.x86_64
(2)选择对应的下载软件
点击 Red Hat JBoss Enterprise Application Platform 6.4.0 Webserver Connector Natives for RHEL 6 x86_64
下载后文件名称是:jboss-eap-native-webserver-connectors-6.4.0-RHEL6-x86_64.zip

2. 安装 mod_cluster
(1)# cd /opt/jbshome
(2)# unzip jboss-eap-native-webserver-connectors-6.4.0-RHEL6-x86_64.zip
(3)# cd jboss-eap-6.4/modules/system/layers/base/native/lib64/httpd/modules
(4)# cp *.so /opt/jbshome/jboss-ews-2.1/httpd/modules/
(5)cd /opt/jbshome/jboss-ews-2.1/httpd/modules
(6)rm mod_jk.so
(7)# cp /opt/jbshome/software/jboss-eap-6.4/modules/system/layers/base/native/etc/httpd/conf/mod_cluster.conf /opt/jbshome/jboss-ews-2.1/httpd/conf.d
(8)# vim /opt/jbshome/jboss-ews-2.1/httpd/conf.d/mod_cluster.conf
修改如下:
# mod_proxy_balancer should be disabled when mod_cluster is used
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
LoadModule slotmem_module modules/mod_slotmem.so
LoadModule manager_module modules/mod_manager.so
LoadModule advertise_module modules/mod_advertise.so

MemManagerFile /var/cache/mod_cluster

<IfModule manager_module>
  #Listen 80
  <VirtualHost *:80>
    <Directory />
      Order deny,allow
      Allow from all
    </Directory>
    ServerAdvertise Off
    EnableMCPMReceive On
    ManagerBalancerName myBalancer
    KeepAliveTimeout 60
    MaxKeepAliveRequests 0
   <Location /mod_cluster-manager>
      SetHandler mod_cluster-manager
      Order deny,allow
      Allow from all
   </Location>
  </VirtualHost>
</IfModule>

 (9)# cd /opt/jbshome/jboss-ews-2.1
(10)# chown -R apache:apache httpd
 修改完后,运行 ls -l 检查一下是否改过来了。

3. 重启 Apache Httpd Server
(1)# cd /opt/jbshome/jboss-ews-2.1/httpd/sbin
(2)# ./apachectl restart
(3)访问 http://localhost/mod_cluster-manager

4. 为了能够让其它机器能够访问Apache Httpd Server 所在的机器,需要把防火墙关掉:
(1)iptables -F
(2)iptables -L -n
(3)临时停掉防火墙:/etc/init.d/iptables stop
(4)彻底关掉防火墙:chkconfig iptables off
(5)访问 http://<IP_ADDRESS>/mod_cluster-manager

5. 如果还不能访问http://<IP_ADDRESS>/mod_cluster-manager,关闭SELinux
 (1)vim /etc/sysconfig/selinux,内容如下:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
执行 # setenforce 0, 设置SELinux 成为permissive模式。
说明:如果执行# setenforce 1,将会把SELinux 设置成为enforcing模式。
执行# getenforce,查看确认SELinux 已经设置为permissive模式。
如果为了省事,可以直接设置SELINUX=disabled,这样重启以后,不用每次执行setenforce 0。

没有评论: