9 Replies Latest reply on Jan 29, 2015 5:40 AM by luiz_gustavo

    How to set up mod_advertise on JBoss 6.0

    qmpeltaty

      Hello

       

      I manage to run basic mod_cluster implementation with static httpd deamons list using <property name="proxyList">${jboss.mod_cluster.proxyList:}</property>.

       

      Now i would like to set it up with mod_advertise using <property name="advertise">${jboss.mod_cluster.advertise.enabled:true}</property> with 224.0.1.150 as advertiseGroupAddress, 23364 as advertisePort and httpd_IP as AdvertiseGroupInterface.

       

      <property name="advertise">${jboss.mod_cluster.advertise.enabled:true}</property>

       

          <!-- Multicast address on which to listen for advertisements -->

          <property name="advertiseGroupAddress">

            <value-factory bean="ServiceBindingManager" method="getStringBinding">

              <parameter>ModClusterService</parameter>

              <parameter>AdvertiseGroup</parameter>

              <parameter><null/></parameter>

            </value-factory>

          </property>

          <!-- Port on which to listen for advertisements -->

          <property name="advertisePort">

            <value-factory bean="ServiceBindingManager" method="getIntBinding">

              <parameter>ModClusterService</parameter>

              <parameter>AdvertiseGroup</parameter>

            </value-factory>

          </property>

          <!-- Network interface address on which to listen for advertisements -->

          <property name="advertiseInterface">

            <value-factory bean="ServiceBindingManager" method="getStringBinding">

              <parameter>ModClusterService</parameter>

              <parameter>AdvertiseGroupInterface</parameter>

              <parameter><null/></parameter>

            </value-factory>

          </property>

       

      How mod-cluster-jboss-beans.xml should be modified to do it ?

       

      My httpd.conf prepared for this is :

       

      <VirtualHost *:8000>

                  <Directory />

                              Order deny,allow

                              Allow from all

                  </Directory>

                  <Location /mod_cluster_manager>

                                    AllowDisplay On

                              SetHandler mod_cluster-manager

                              Order deny,allow

                              Allow from all

                  </Location>

                  KeepAliveTimeout 60

                  MaxKeepAliveRequests 0

                  ManagerBalancerName test

                    ServerAdvertise On

                  AdvertiseFrequency 5

                    AdvertiseGroup 224.0.1.105:23364

                    AdvertiseBindAddress 0.0.0.0:23364

       

       

      </VirtualHost>

       

      BR

      Qmpeltaty

        • 1. Re: How to set up mod_advertise on JBoss 6.0
          jfclere

          Why you just don't set:

          <property name="advertise">true</property>

          <property name="advertiseGroupAddress">224.0.1.105</property>

          <property name="advertisePort">23364</property>

           

          In mod-cluster-jboss-beans.xml and remove the proxyList

          • 2. Re: How to set up mod_advertise on JBoss 6.0
            qmpeltaty

            I followed by your suggestion and set up apache and jboss instances as follows :

             

            <VirtualHost *:8000>

                        <Directory />

                                    Order deny,allow

                                    Allow from all

                        </Directory>

                        <Location /mod_cluster_manager>

                                                                        AllowDisplay On

                                    SetHandler mod_cluster-manager

                                    Order deny,allow

                                    Allow from all

                        </Location>

                        KeepAliveTimeout 60

                        MaxKeepAliveRequests 0

                        ManagerBalancerName test

                        AdvertiseFrequency 5

                        AdvertiseGroup 224.0.1.106:23364

             

            </VirtualHost>

             

             

            I've set up mod_cluster-jboss-beans.xml for each node as follows :

             

                <!-- URL prefix to send with commands to mod_cluster.  Default is no prefix. -->

                <!--property name="proxyURL"></property-->

             

                <!-- mod_advertise is a small httpd module that advertises the

                     availability of httpd servers via multicast, allowing

                     ModClusterService to discover the httpd front-end instead of/in

                     addition to having them defined in proxyList. -->

                <!-- Whether to listen for advertise messages -->

                <property name="advertise">true</property>

                <!-- Multicast address on which to listen for advertisements -->

                <property name="advertiseGroupAddress">224.0.1.106</property>

                <!-- Port on which to listen for advertisements -->

                <property name="advertisePort">23364</property>

                <!-- Network interface address on which to listen for advertisements -->

                <property name="advertiseInterface">192.168.1.206</property>

             

             

            Then my httpd:8000/mod_cluster_manager doesn't show any cluster nodes connected, but i see in JBosses console that nodes see each other (f.x. node1 shows that node2 has been closed when i kill the node2 process)

             

             

            Error i got on both AS instances :

             

            14:47:27,108 INFO  [org.jboss.modcluster.mcmp.impl.DefaultMCMPHandler] IO error

            sending command INFO to proxy www.mydomain.com/87.248.217.254:8000: java.net.Con

            nectException: Connection refused: connect

                    at java.net.PlainSocketImpl.socketConnect(Native Method) [:1.6.0_22]

                    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) [:1.6.0_

            22]

                    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) [

            :1.6.0_22]

                    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) [:1.6.0_22

            ]

                    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) [:1.6.0_22

            ]

                    at java.net.Socket.connect(Socket.java:529) [:1.6.0_22]

                    at org.jboss.modcluster.mcmp.impl.DefaultMCMPHandler$Proxy.getConnection

            (DefaultMCMPHandler.java:883)

                    at org.jboss.modcluster.mcmp.impl.DefaultMCMPHandler$Proxy.getConnection

            Writer(DefaultMCMPHandler.java:909)

                    at org.jboss.modcluster.mcmp.impl.DefaultMCMPHandler.sendRequest(Default

            MCMPHandler.java:532)

                    at org.jboss.modcluster.mcmp.impl.DefaultMCMPHandler.sendRequest(Default

            MCMPHandler.java:646)

                    at org.jboss.modcluster.mcmp.impl.DefaultMCMPHandler.status(DefaultMCMPH

            andler.java:399)

                    at org.jboss.modcluster.mcmp.impl.DefaultMCMPHandler.status(DefaultMCMPH

            andler.java:377)

                    at org.jboss.modcluster.ha.HAModClusterService$ClusteredModClusterServic

            e.updateClusterStatus(HAModClusterService.java:1186)

                    at org.jboss.modcluster.ha.HAModClusterService$ClusteredModClusterServic

            e.status(HAModClusterService.java:1167)

                    at org.jboss.modcluster.ha.HAModClusterService.status(HAModClusterServic

            e.java:359)

                    at org.jboss.modcluster.catalina.CatalinaEventHandlerAdapter.handleNotif

            ication(CatalinaEventHandlerAdapter.java:427)

                    at sun.reflect.GeneratedMethodAccessor233.invoke(Unknown Source) [:1.6.0

            _22]

                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

            sorImpl.java:25) [:1.6.0_22]

                    at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_22]

                    at org.jboss.mx.notification.NotificationListenerProxy.invoke(Notificati

            onListenerProxy.java:154)

                    at $Proxy156.handleNotification(Unknown Source) at org.jboss.mx.util.JBo

            ssNotificationBroadcasterSupport.handleNotification(JBossNotificationBroadcaster

            Support.java:127)

                    at org.jboss.mx.util.JBossNotificationBroadcasterSupport.sendNotificatio

            n(JBossNotificationBroadcasterSupport.java:108)

                    at org.jboss.web.tomcat.service.deployers.TomcatService.startConnectors(

            TomcatService.java:641)

                    at org.jboss.web.tomcat.service.deployers.TomcatService.handleNotificati

            on(TomcatService.java:679)

                    at sun.reflect.GeneratedMethodAccessor233.invoke(Unknown Source) [:1.6.0

            _22]

                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

            sorImpl.java:25) [:1.6.0_22]

                    at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_22]

                    at org.jboss.mx.notification.NotificationListenerProxy.invoke(Notificati

            onListenerProxy.java:154)

                    at $Proxy155.handleNotification(Unknown Source) at javax.management.Noti

            ficationBroadcasterSupport.handleNotification(NotificationBroadcasterSupport.jav

            a:257) [:1.6.0_22]

                    at javax.management.NotificationBroadcasterSupport$SendNotifJob.run(Noti

            ficationBroadcasterSupport.java:322) [:1.6.0_22]

                    at javax.management.NotificationBroadcasterSupport$1.execute(Notificatio

            nBroadcasterSupport.java:307) [:1.6.0_22]

                    at javax.management.NotificationBroadcasterSupport.sendNotification(Noti

            ficationBroadcasterSupport.java:229) [:1.6.0_22]

                    at org.jboss.bootstrap.impl.base.server.AbstractServer.sendNotificationW

            ithCurrentTimeUserData(AbstractServer.java:791) [jboss-bootstrap-impl-base.jar:2

            .1.0-alpha-5]

                    at org.jboss.bootstrap.impl.base.server.AbstractServer.sendStartJmxNotif

            ication(AbstractServer.java:768) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]

                    at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.r

            un(AbstractServer.java:420) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]

                    at java.lang.Thread.run(Thread.java:662) [:1.6.0_22]

             

            How to handle with it ?

             

             

            To make it more clear i will write more about my configuration. I run two JBossAS 6.0 instances and Apache 2.2.18 run on same Win2k3 x64 machine with three different IP addresses on same network interface :

             

            - 192.168.1.205/24 - JBossAP node1

            - 192.168.1.206/24 - Apache

            - 192.168.1.207/24 - JBossAP node2

             

            I run both JBoss instances from command line using :

             

            Node1 :

            path_to_jboss\bin\run.bat -c node1 -g test -b 192.168.1.205 -Djboss.Domain=test -Djboss.messaging.ServerPeerID=1 -Djboss.service.binding.set=ports-default -Djboss.jvmRoute=node1

             

            Node2 :

            path_to_jboss\bin\run.bat -c node2 -g test -b 192.168.1.207 -Djboss.Domain=test -Djboss.messaging.ServerPeerID=2 -Djboss.service.binding.set=ports-default -Djboss.jvmRoute=node2

            • 3. Re: How to set up mod_advertise on JBoss 6.0
              jfclere

              It seems mod_cluster doesn't advertise the Apache httpd address you need but 87.248.217.254:8000.

              Don't use <VirtualHost *:8000> but an IP/host the nodes could connect to.

              May you need a ServerAdvertise directive (See http://docs.jboss.org/mod_cluster/1.1.0/html/native.config.html#d0e650)

               

              For more on problems with configuration see http://docs.jboss.org/mod_cluster/1.1.0/html/faq.html

              • 4. Re: How to set up mod_advertise on JBoss 6.0
                qmpeltaty

                ServerAdvertise On and <VirtualHost 192.168.1.206:8000> made the trick - it's working now Jean-Frederic - Thank you for your help

                • 5. Re: How to set up mod_advertise on JBoss 6.0
                  luiz_gustavo

                  Hi!

                   

                  There's a long time since this post was written, but I hope you can help me.

                  By far this is the post that most helped me configuring mod_cluster with JBoss after I get stuck in some configuration problems.

                   

                  I think I'm almost getting to a happy end with this, because my JBoss nodes are already trying to send notifications to the Apache proxy, but I'm getting these errors in nodes' logs:

                   

                   

                  2014-02-14 09:54:46,136 ERROR [org.jboss.modcluster.mcmp.impl.DefaultMCMPHandler] (Incoming-7,null) Error [null: null: {4}] sending command INFO to proxy /192.168.0.115:9999, configuration will be reset

                   

                   

                  In the Apache logs I have these errors:

                   

                  [Fri Feb 14 10:07:53 2014] [error] [client 192.168.0.115] Invalid method in request INFO / HTTP/1.0

                  [Fri Feb 14 10:07:59 2014] [error] [client 192.168.0.115] Invalid method in request INFO / HTTP/1.0

                  [Fri Feb 14 10:07:59 2014] [error] [client 192.168.0.115] Invalid method in request INFO / HTTP/1.0

                   

                   

                  My development environment is this:

                   

                  Win7 64 bits
                  JDK 1.6.0.45

                  JBoss 6.1

                  Mod_Cluster derived from mod_cluster-1.2.6.Final-windows-amd64.zip package

                   

                   

                  I have some virtual hosts in my local adaptor:

                   

                  192.168.0.115

                  192.168.0.116

                  192.168.0.117

                  192.168.0.118

                  192.168.0.119

                   

                  But I'm connected in wireless adaptor while doing the testes, in another lan (10.0.0.X)

                   

                  I configured Apache on 192.168.0.115. My httpd.conf is this (most important part, tell me if more information can help):

                   

                  LoadModule proxy_module modules/mod_proxy.so

                  LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

                  LoadModule proxy_http_module modules/mod_proxy_http.so

                  LoadModule proxy_cluster_module modules/mod_proxy_cluster.so

                  LoadModule manager_module modules/mod_manager.so

                  LoadModule slotmem_module modules/mod_slotmem.so

                  LoadModule advertise_module modules/mod_advertise.so

                   

                  # MOD_CLUSTER_ADDS

                  # Adjust to you hostname and subnet.

                   

                  Listen 192.168.0.115:9999

                  ManagerBalancerName mycluster

                   

                  <VirtualHost 192.168.0.115:9999>

                    <Location />

                    Order deny,allow

                    Deny from all

                    Allow from all

                    </Location>

                   

                    KeepAliveTimeout 60

                      MaxKeepAliveRequests 0

                      ServerAdvertise On

                      AdvertiseFrequency 5

                      AdvertiseGroup 224.0.1.105:23364

                   

                    <Location /mod_cluster_manager>

                      SetHandler mod_cluster-manager

                      Order deny,allow

                      Deny from all

                      Allow from all

                    </Location>

                   

                  </VirtualHost>

                   

                   

                  mod_cluster_manager seems fine (although it can not list nodes):

                   

                  mcm.png

                  I had to use port 9999 since port 6666 did not work for me.

                   

                  I have four JBoss nodes, being two groups of two nodes. I start these nodes like this:

                   

                  run.bat -c node1 -b 192.168.0.116 -g CLUSTER-A -u 224.0.1.105 -Djboss.messaging.ServerPeerID=1 -Djboss.Domain=CLUSTER-A -Djboss.jvmRoute=node1

                  run.bat -c node2 -b 192.168.0.117 -g CLUSTER-A -u 224.0.1.105 -Djboss.messaging.ServerPeerID=2 -Djboss.Domain=CLUSTER-A -Djboss.jvmRoute=node2

                  run.bat -c node3 -b 192.168.0.118 -g CLUSTER-B -u 224.0.1.105 -Djboss.messaging.ServerPeerID=3 -Djboss.Domain=CLUSTER-B -Djboss.jvmRoute=node3

                  run.bat -c node4 -b 192.168.0.119 -g CLUSTER-B -u 224.0.1.105 -Djboss.messaging.ServerPeerID=4 -Djboss.Domain=CLUSTER-B -Djboss.jvmRoute=node4

                   

                   

                  I have this configurations in each node, in mod_cluster-jboss-beans.xml:

                   

                   

                  <!-- Comma separated list of address:port listing the httpd servers

                           where mod_cluster is running. -->

                      <property name="proxyList">${jboss.mod_cluster.proxyList:}</property>

                    <!-- Whether to listen for advertise messages -->

                    <property name="advertise">true</property>

                    <!-- Multicast address on which to listen for advertisements -->

                    <property name="advertiseGroupAddress">224.0.1.105</property>

                    <!-- Port on which to listen for advertisements -->

                    <property name="advertisePort">23364</property>

                    <!-- Port on which to listen for advertisements -->

                    <property name="advertiseInterface">192.168.0.115</property>

                   

                   

                  (I'm using the mod_cluster.sar that came with JBoss. That one avaliable with mod_cluster_bundle did not work properly).

                   

                  Looking to the messages on the console I can see that the nodes are talking to each other and trying to communicate with Apache:

                   

                  nodes.png

                   

                   

                  So, I'm still missing something in this scenario. Can you help me please?

                  • 6. Re: How to set up mod_advertise on JBoss 6.0
                    jfclere

                    EnableMCPMReceive missiing?

                    • 7. Re: How to set up mod_advertise on JBoss 6.0
                      luiz_gustavo

                      Hi Jean-Frederic,

                       

                      that was the problem. I had forgotten this configuration.

                       

                      This tip you gave:

                       

                      Why you just don't set:

                      <property name="advertise">true</property>

                      <property name="advertiseGroupAddress">224.0.1.105</property>

                      <property name="advertisePort">23364</property>

                       

                      In mod-cluster-jboss-beans.xml and remove the proxyList

                       

                      helped me a lot. thank you!

                      • 8. Re: How to set up mod_advertise on JBoss 6.0
                        arofah.akbar

                        Hai, I know its almost a year after the post, but I have same problem and didn't find mod-cluster-jboss-beans.xml in my apache or jboss.

                        Can you tell me how exactly you fix the problem. Thank you.

                        • 9. Re: How to set up mod_advertise on JBoss 6.0
                          luiz_gustavo

                          Hi arofah akbar!

                           

                          At the time I posted here, I was configuring a cluster on JBoss 6.1.

                          In this version of JBoss, you can find mod_cluster-jboss-beans.xml file in this path:

                           

                          jboss-6.1.0.Final\server\default\deploy\mod_cluster.sar\META-INF\mod_cluster-jboss-beans.xml

                           

                          Best regards!