mod_cluster的設定方式
Auther: Marvin Create date 2016/11/19

mod_cluster是一個基於Apache Web Server的模組,可以用來做負載平衡,或代理的模組。主要可以用來和JBoss相關的Ap server做搭配,今天就介紹一下這個設定方式

首先需要再Apache Web Server的httpd.conf設定檔案裡先讀取模組

LoadModule cluster_slotmem_module modules/mod_cluster_slotmem.so

LoadModule manager_module modules/mod_manager.so

LoadModule proxy_cluster_module modules/mod_proxy_cluster.so

LoadModule advertise_module modules/mod_advertise.so

再來就是在httpd.conf設定管理模組如下

<IfModule manager_module>

  Listen 192.168.0.123:6666

  ManagerBalancerName mycluster

  <VirtualHost 192.168.0.123:6666>

    <Location />

             Require all granted

            Allow from 192.168.0

    </Location>

    KeepAliveTimeout 300

    MaxKeepAliveRequests 0

    ServerAdvertise on http://192.168.0.123:6666

    AdvertiseFrequency 5

    #AdvertiseSecurityKey secret

    AdvertiseGroup 224.0.1.105:23364

    EnableMCPMReceive

 

    <Location /mod_cluster_manager>

       SetHandler mod_cluster-manager

       Allow from 192.168.0

    </Location>

 

  </VirtualHost>

</IfModule>

比較需要注意的倒是如果Apache Web Server是架在Linux,如CentOS、Red Hat、Oracle Linex則需要用su指令切換身分到root才能做相關的SELinux設定

mod_cluster官方網站網址為http://mod-cluster.jboss.org/