zoukankan      html  css  js  c++  java
  • JBOSS通过Apache负载均衡方法二:使用mod_cluster

          本文介绍使用mod_cluster组件通过apache来对JBOSS做负载均衡。基本环境为:linux RH6.3 64bit下使用jboss-eap-6.0和mod-cluster 1.2.6(集成了mod cluster相关组件的apache,mod_cluster-1.2.6.Final-linux2http-x64.tar.gz,可通过jboss官网的如下连接下载http://mod-cluster.jboss.org/downloads/1-2-6-Final-bin)。

    对于apache部分,通过编辑/opt/jboss/httpd/httpd/conf/httpd.conf文件来修改的配置文件:

    </IfModule>

    # MOD_CLUSTER_ADDS

    # Adjust to you hostname and subnet.

    <IfModule manager_module>

      Listen 172.18.49.203:6666

    #  ManagerBalancerName mycluster

      ManagerBalancerName TestCluster

      <VirtualHost 172.18.49.203:6666>

        <Location />

         Order deny,allow

         Deny from all

         Allow from all

        </Location>

     

        KeepAliveTimeout 300

        MaxKeepAliveRequests 0

        #ServerAdvertise on http://@IP@:6666

        AdvertiseFrequency 5

        #AdvertiseSecurityKey secret

        AdvertiseGroup 224.0.1.106:23365

     

     

        ServerAdvertise On

        AllowDisplay On

     

        <Location /mod_cluster_manager>

           SetHandler mod_cluster-manager

           Order deny,allow

           Deny from all

           #Allow from 127.0.0

           Allow from all

        </Location>

     

      </VirtualHost>

    </IfModule>

    配置文件修改完成后,通过/opt/jboss/httpd/sbin/httpd -k start启动apache即可。如下则表明apache启动成功。

    jboss-eap-6.0已经集成了mod cluster。对于JBOSS部分,按照如下方法更改配置文件。

    要使用mod cluster,必须使用standalone-full-ha.xml或standalone-ha.xml文件来配置JBOSS。

            <subsystem xmlns="urn:jboss:domain:modcluster:1.1">

                <mod-cluster-config advertise-socket="modcluster" proxy-list="172.18.49.203:6666" balancer="TestCluster" sticky-session="true"  connector="ajp">

                    <dynamic-load-provider>

                        <load-metric type="busyness"/>

                    </dynamic-load-provider>

                </mod-cluster-config>

            </subsystem>

    其中balancer属性需要与Apache中的ManagerBalancerName保持一致。

    如果局域网中还有其它多播地址,还需要将以下部分更改为新的多播地址,Apache中相应的AdvertiseGroup也要与其更改为同一地址。

    <socket-binding name="modcluster" port="0" multicast-address="224.0.1.106" multicast-port="23365"/>

    更改配置后启动JBOSS,访问apache的mod_cluster_manager页面,显示如下,则说明modcluster正常负载。

  • 相关阅读:
    (树的直径)第九届湘潭市大学生程序设计比赛 H-Highway
    (记忆化DFS)Codeforces Round #413 D-Field expansion
    (树状数组)Codeforces Round #413 C-Fountains
    (几何)LeetCode Weekly Contest 32 D-Erect the Fence
    LeetCode Weekly Contest 32 解题报告
    (贪心)华师大程序设计竞赛 F-丽娃河的狼人传说
    (最短路)AtCoder Beginner Contest 061 D
    Tinkoff Challenge
    Codeforces Round #410 (Div. 2) 解题报告
    (二叉树)UVA
  • 原文地址:https://www.cnblogs.com/liulei058/p/4045887.html
Copyright © 2011-2022 走看看