6 Replies Latest reply on Oct 1, 2013 11:38 AM by weinanli

    What are the steps to do clustering on JBoss AS 7 with mod_cluster in HTTP server?


      Hi All,


      Can any one please tell me what are typical steps to implement application clustering and Load balancing in Jboss AS 7 with mod_cluster in Apache HTTP Server? I have tried following steps but not sure whether these are fully correct. If any corrections needs to be done please tell me.


      Operating system used : Windows XP prof.


      Configuration done on JBoss side

      I need to mention that I have configured "standard-ha.xml" for each of the four nodes as below-


      1.  <server name="node1" xmlns="urn:jboss:domain:1.2"> 

           name="nodeX" is mentioned for each of the four node for <server> tag.


      2. mod_cluster is configured:

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

                  <mod-cluster-config advertise-socket="modcluster" proxy-list="">


                          <load-metric type="busyness"/>





      3. Instance Id is mentioned :


             <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" instance-id="${jboss.node.name}">

                  <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>

                  <virtual-server name="default-host" enable-welcome-root="true">

                      <alias name="localhost"/>

                      <alias name="example.com"/>




      For Apache HTTP Server 2.2 - I have configured following things for mod_cluster and SSL configuration -


      APACHE HOME is C:\ApacheHTTP


      1. Certificate is generated using openSSL command -


           A.   C:\ApacheHTTP\bin> openssl genrsa -des3 -out server.key 1024

            B.   C:\ApacheHTTP\bin> openssl rsa -in server.key -out server.pem

           C.   C:\ApacheHTTP\bin> openssl req -new -key server.key -out server.csr

            D.   C:\ApacheHTTP\bin> openssl x509 -req -days 30 -in server.csr -signkey server.key -out server.crt


      Above commands have been given sequentially, and during creation of SERVER.CSR file system asked to enter values for few fields e.g. passphrase, country, organisation, commonname(entered "localhost") etc.

      server.pem and server.crt files have been copied to C:\ApacheHTTP\conf


      httpd.conf file has been modified as below -


      Following modules added


      LoadModule proxy_module modules/mod_proxy.so

      LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

      LoadModule slotmem_module modules/mod_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

      LoadModule proxy_http_module modules/mod_proxy_http.so

      LoadModule ssl_module modules/mod_ssl.so


      Uncomment following lines :

      #Include conf/extra/httpd-default.conf    -->  Include conf/extra/httpd-default.conf

      #0Include conf/extra/httpd-ssl.conf    ---->    Include conf/extra/httpd-ssl.conf


      in httpd-ssl.conf

      following line is added

      SSLCertificateFile "C:/Program Files/Apache Software Foundation/Apache2.2/conf/server.crt"

      SSLCertificateKeyFile "C:/Program Files/Apache Software Foundation/Apache2.2/conf/server.pem"


      Lines were present but commented out. I have changed the path of certificate files and uncomment the lines.


      HTTP server was restarted.


      Changes done in Application web.xml and in jboss-web.xml:


      The <distributable/> tag is used in web.xml for each deployed application.

      jboss-web.xml is added under WEB-INF folder of the web application for SESSION REPLICATION.








      An application WAR is copied to %JBOSS_HOME%/standalone/deployment/  for each instance of jboss.

      Each jboss node is started with following commands:  (http port no. is kept same, port-offset is used different)


      Node 1) E:/server1/jboss7/bin> standalone.bat -Djboss.node.name=node1 --server-config=standalone-ha.xml -Djboss.socket.binding.port-offset=100

      Node 2) E:/server2/jboss7/bin> standalone.bat -Djboss.node.name=node2 --server-config=standalone-ha.xml -Djboss.socket.binding.port-offset=200

      Node 3) E:/server3/jboss7/bin> standalone.bat -Djboss.node.name=node3 --server-config=standalone-ha.xml -Djboss.socket.binding.port-offset=300

      Node 4) E:/server4/jboss7/bin> standalone.bat -Djboss.node.name=node4 --server-config=standalone-ha.xml -Djboss.socket.binding.port-offset=400


      But when accessing the application from browser with the URL :


      https://localhost/Greenworld initially it shows login screen  but on login it crashes and shows the URL : http://localhost:8185/Greenworld/login.xhtml and the page remains same. Nothing happens after that.


      Can anyone please tell what wrong I'm doing ?





      Jayanta P.

        • 2. Re: What are the steps to do clustering on JBoss AS 7 with mod_cluster in HTTP server?

          What is your problem solved? If solved, can you tell me how to configure it? I am also in the windows installed jboss cluster is standalone form, is also prepared to use apache http server, but some configuration is not very clear.Thank you!

          • 3. Re: What are the steps to do clustering on JBoss AS 7 with mod_cluster in HTTP server?

            I'm assuming you figured this out by now, but for the sake of those still searching I'll add some additional configuration I had to do to get it to work.


            I first want to say that many of the cofiguration steps that are needed are because there are still some bugs that need worked out in AS 7.1.1.Final in regards to clustering.  I was able to implement everything in EAP 6.1 simply by starting servers using standalone-ha.xml and starting up the httpd server and it worked.  Unfortunately EAP 6.1 uses a patched modcluster implementation as the modcluster tag in standalone-ha.xml is <subsystem xmlns="urn:jboss:domain:modcluster:1.1"> where AS 7.1.1 ships with <subsystem xmlns="urn:jboss:domain:modcluster:1.0"> notice the 1.1 and 1.0 difference.


            Don't lost hope, you can still get it all to work in 7.1.1.Final you just have to set a few more params.  This is my configuration that works for me:

            From standalone-full-ha.xml:


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

                      <mod-cluster-config advertise-socket="modcluster" proxy-list="XXX.XXX.XXX.XXX:6666" advertise="true" advertise-security-key="Dev_Cluster">


                                <load-metric type="busyness"/>





                 <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" instance-id="${jboss.node.name}" native="false">



            From httpd.conf:


            # MOD_CLUSTER_ADDS

            # Adjust to you hostname and subnet.

            <IfModule manager_module>

              Listen XXX.XXX.XXX.XXX:6666

              ManagerBalancerName mycluster

              <VirtualHost XXX.XXX.XXX.XXX:6666>

                <Location />

                 Order deny,allow

                 Deny from all

                 Allow from XXX.XXX.XXX.XXX

                 Allow from




                KeepAliveTimeout 300

                MaxKeepAliveRequests 0

                #ServerAdvertise on

                AdvertiseFrequency 5

                AdvertiseSecurityKey DEV_Cluster




                <Location /mod_cluster_manager>

                   SetHandler mod_cluster-manager

                   Order deny,allow

                   Deny from all

                   Allow from





            Notice that where XXX.XXX.XXX.XXX is present it represents the ip address of the httpd server as seen in ipconfig.

            • 4. Re: What are the steps to do clustering on JBoss AS 7 with mod_cluster in HTTP server?

              Great post Logan - the proxy-list attribute (I think) was the missing link for me.

              Matching it to the Listen address within the apache config.

              Makes sense.


              I now have both local and remote jboss servers connecting to the same load-balancer group.

              • 5. Re: What are the steps to do clustering on JBoss AS 7 with mod_cluster in HTTP server?

                You don't need to configure proxy-list if you want to automagically discover HTTPd nodes. You need to have multicast enabled on your network and correctly routed the default multicast group.

                • 6. Re: What are the steps to do clustering on JBoss AS 7 with mod_cluster in HTTP server?

                  +1. And please use the newest JBoss EAP 6.1.0.Final which fixes many bugs regarding with mod_cluster + AS7 clustering.