5 Replies Latest reply on Mar 30, 2010 3:16 AM by jfclere

    cannot set up mod_cluster using (following http://www.jboss.org/mod_cluster/quick-start.html)

    gnome

      Hi

       

      I have  the following configuration:

      >   one httpd server (which will act as a load balancer ) downloaded the one given at the above website.

             (ip address of the machine : 192.168.1.102 ))

      >  2 jboss application servers(version 6.0.0.M1)

             (IP addresses of the machines :: 192.168.1.101 and 192.168.1.103)

       

      I was following the quick start guide but cannot get the whole set up running.

      Added the below config to my httpd.conf (all the other things are same as before. After these changes <Directory /> gets defined twice in httpd.conf, so i changed "deny from all"  -to-> "deny from none" and added "allow from all" in that directive)

       

       

      LoadModule proxy_module /opt/jboss/httpd/lib/httpd/modules/mod_proxy.so
      LoadModule proxy_ajp_module /opt/jboss/httpd/lib/httpd/modules/mod_proxy_ajp.so
      LoadModule slotmem_module /opt/jboss/httpd/lib/httpd/modules/mod_slotmem.so
      LoadModule manager_module /opt/jboss/httpd/lib/httpd/modules/mod_manager.so
      LoadModule proxy_cluster_module /opt/jboss/httpd/lib/httpd/modules/mod_proxy_cluster.so
      LoadModule advertise_module /opt/jboss/httpd/lib/httpd/modules/mod_advertise.so

      Listen 192.168.1.102:9999
      <VirtualHost 192.168.1.102:9999>
         <Directory />
            Order deny,allow
            Deny from all
            Allow from 192.168.1.
         </Directory>
      KeepAliveTimeout 60
      MaxKeepAliveRequests 0
      ManagerBalancerName mycluster
      AdvertiseFrequency 5
      </VirtualHost>

       

      Only needed to enable this line for <depends>ModClusterListener</depends>  for jboss-6 in $JBOSS_HOME/server/all/deploy/jbossweb.sar/META-INF/jboss-beans.xml. Rest of the configs where enabled by default.  (in the quick start guide the name given is ModClusterService but in the config files of jboss 6 it is ModClusterListener, dont know the difference between the two)

       

      I did not configure the jvm route as it is not necessary and i just want to get the things running initially.

       

      I start the httpd server using ./apachectl start. I start the jboss servers after that.

      When i do http://192.168.1.102:9999 on my localhost i should expect to see the jboss main page but i get the "IT WORKS" page in the apache httpd server (am i wrong here...??). if i deploy some application in the jboss and then try to access it as http://192.168.1.102:9999/app-name/ (where app-name is the context root) i get page requested not found exception (404).

       

      Doesnt the quick start guide enable us to redirect all the requests from the httpd to the jboss servers in the above scenario..??

       

      I dont know where I am going wrong. Isnt this the way it should have worked.

       

      This is my httpd error log btw:

      *

       

      [Sun Mar 28 16:05:46 2010] [warn] module manager_module is already loaded, skipping

      [Sun Mar 28 16:05:46 2010] [warn] module proxy_cluster_module is already loaded, skipping

      [Sun Mar 28 16:05:46 2010] [warn] module advertise_module is already loaded, skipping

      [Sun Mar 28 16:05:46 2010] [notice] Digest: generating secret for digest authentication ...

      [Sun Mar 28 16:05:46 2010] [notice] Digest: done

      [Sun Mar 28 16:05:47 2010] [warn] No JkLogFile defined in httpd.conf. Using default /opt/jboss/httpd/httpd/logs/mod_jk.log

      [Sun Mar 28 16:05:47 2010] [warn] No JkShmFile defined in httpd.conf. Using default /opt/jboss/httpd/httpd/logs/jk-runtime-status

       

      [Sun Mar 28 16:05:47 2010] [notice] Advertise initialized for process 20252

      [Sun Mar 28 16:05:47 2010] [notice] Apache/2.2.13 (Unix) mod_cluster/1.1.x mod_ssl/2.2.13 OpenSSL/0.9.8k DAV/2 mod_jk/1.2.27 configured -- resuming normal operations

      [Sun Mar 28 16:10:18 2010] [error] [client 192.168.1.102] File does not exist: /opt/jboss/httpd/htdocs/htdocs/app-name

      *

      I even tried to do the above   with httpd and Jboss all running on my localhost but i was not able to configure it.

       

      I have also seen people using

       

      <Location /mod_cluster-manager>

      SetHandler mod_cluster-manager
      Order deny,allow
      Deny from all
      Allow from 127.0.0.1
      </Location>

      is this an application and what does it do and how should I configure it?

       

       

      Kindly let me know your inputs and comments.

       

      Thanks

        • 1. Re: cannot set up mod_cluster using (following http://www.jboss.org/mod_cluster/quick-start.html)
          jfclere

          Only needed to enable this line for <depends>ModClusterListener</depends>  for jboss-6 in $JBOSS_HOME/server/all/deploy/jbossweb.sar/META-INF/jboss-beans.xml. Rest of the configs where enabled by default.  (in the quick start guide the name given is ModClusterService but in the config files of jboss 6 it is ModClusterListener, dont know the difference between the two)

           

          ModClusterService is for 1.0.x and   ModClusterListener is for 1.1.x we will fix the doc.

           

          Doesnt the quick start guide enable us to redirect all the requests from the httpd to the jboss servers in the above scenario..??

           

          Well no: you have to check excludedContexts in the mod_cluster-jboss-beans.xml the content installed is:

          <property name="excludedContexts">${jboss.mod_cluster.excludedContexts:ROOT,admin-console,invoker,jbossws,jmx-console,juddi,web-console}</property>

          1 of 1 people found this helpful
          • 2. Re: cannot set up mod_cluster using (following http://www.jboss.org/mod_cluster/quick-start.html)
            pferraro

            Jean-Frederic Clere wrote:

             

            Only needed to enable this line for <depends>ModClusterListener</depends>  for jboss-6 in $JBOSS_HOME/server/all/deploy/jbossweb.sar/META-INF/jboss-beans.xml. Rest of the configs where enabled by default.  (in the quick start guide the name given is ModClusterService but in the config files of jboss 6 it is ModClusterListener, dont know the difference between the two)

             

            ModClusterService is for 1.0.x and   ModClusterListener is for 1.1.x we will fix the doc.

             

            I'm in the process of upgrading the docs now.

            When upgrading from 1.0.x to 1.1.x, make sure to use the new mod_cluster-jboss-beans.xml config file, as this file reflects significant - and incompatible changes to the wiring of various objects.

            • 3. Re: cannot set up mod_cluster using (following http://www.jboss.org/mod_cluster/quick-start.html)
              gnome

              Hi

               

              Thanks for the reply. I removed the excluded contexts as you advised and I was able to the load balancing stuff running on my localmachine. Now the httpd redirects the requests to the Jboss servers.

               

              But i had to add the address of the mod_cluster node (the httpd node) in this configuration parameter of file mod_cluster-jboss-beans.xml to get it running.

               

               

                  <!-- Comma separated list of address:port listing the httpd servers  where mod_cluster is running. -->
                  <!--property name="proxyList">${jboss.mod_cluster.proxyList:}</property-->
                  <property name="proxyList">${jboss.mod_cluster.proxyList:127.0.0.1:9999}</property>

               

               

              But in the logs of httpd I notice the following error.Is there some issue with my configuration or is this an error to be ignored, I was able to access the application i deployed on jboss without any problem.

               

               

              [Mon Mar 29 11:50:11 2010] [error] proxy: CLUSTER: (balancer://mycluster). All workers are in error state

              [Mon Mar 29 11:50:11 2010] [error] ajp_cping_cpong: apr_socket_recv failed

              [Mon Mar 29 11:50:16 2010] [error] ajp_cping_cpong: apr_socket_recv failed

              [Mon Mar 29 11:50:20 2010] [error] ajp_cping_cpong: apr_socket_recv failed

              [Mon Mar 29 11:50:21 2010] [error] proxy: CLUSTER: (balancer://mycluster). All workers are in error state

              [Mon Mar 29 11:50:21 2010] [error] ajp_cping_cpong: apr_socket_recv failed

              [Mon Mar 29 11:50:25 2010] [error] proxy: CLUSTER: (balancer://mycluster). All workers are in error state

              [Mon Mar 29 11:50:28 2010] [error] proxy: CLUSTER: (balancer://mycluster). All workers are in error state

               

               

               

              I had one more thing to ask. Httpd for load-balancing must be using some scheduling policy like round robin etc etc. If I want to make my own scheduling policy where i want to use the knowledge of the requested url/content to redirect the request, where should i start?? Which files do I need to modify in the httpd (one with mod_cluster enabled) to start with this? Also how can i use the information provided by the back end nodes(Jboss servers in my case) to make a more informed decision to schedule the requests? Also where does one give the scheduling policy to httpd which it uses to dispatch the requests to the backend nodes or it only has one scheduling policy which i will need to replace for my scenario? Any sample program will be really helpful.

               

               

              Thanks

              • 4. Re: cannot set up mod_cluster using (following http://www.jboss.org/mod_cluster/quick-start.html)
                pferraro

                But i had to add the address of the mod_cluster node (the httpd node) in this configuration parameter of file mod_cluster-jboss-beans.xml to get it running.

                 

                 

                    <!-- Comma separated list of address:port listing the httpd servers  where mod_cluster is running. -->
                    <!--property name="proxyList">${jboss.mod_cluster.proxyList:}</property-->
                    <property name="proxyList">${jboss.mod_cluster.proxyList:127.0.0.1:9999}</property>

                To avoid explicitly defining the proxy address:port, you can configure proxy advertisement:

                http://www.jboss.org/mod_cluster/native/config.html#mod_advertise

                http://www.jboss.org/mod_cluster/java/properties.html#advertise

                 

                Alternatively, you can leverage the system property and start JBoss using -Djboss.mod_cluster.proxyList=127.0.0.1:9999

                or hard code it in the config file as you did (though you can remove the system property expansion in this case):

                <property name="proxyList">127.0.0.1:9999</property>

                 

                Yet another option, you can add the proxy at runtime, via ModClusterServiceMBean.addProxy("127.0.0.1", 9999)

                But in the logs of httpd I notice the following error.Is there some issue with my configuration or is this an error to be ignored, I was able to access the application i deployed on jboss without any problem.

                 

                 

                [Mon Mar 29 11:50:11 2010] [error] proxy: CLUSTER: (balancer://mycluster). All workers are in error state

                [Mon Mar 29 11:50:11 2010] [error] ajp_cping_cpong: apr_socket_recv failed

                [Mon Mar 29 11:50:16 2010] [error] ajp_cping_cpong: apr_socket_recv failed

                [Mon Mar 29 11:50:20 2010] [error] ajp_cping_cpong: apr_socket_recv failed

                [Mon Mar 29 11:50:21 2010] [error] proxy: CLUSTER: (balancer://mycluster). All workers are in error state

                [Mon Mar 29 11:50:21 2010] [error] ajp_cping_cpong: apr_socket_recv failed

                [Mon Mar 29 11:50:25 2010] [error] proxy: CLUSTER: (balancer://mycluster). All workers are in error state

                [Mon Mar 29 11:50:28 2010] [error] proxy: CLUSTER: (balancer://mycluster). All workers are in error state

                This is probably due to the short period of time (i.e. 17 seconds) between when the CONFIG command is sent to the proxy (after the WebServer is started), and when the AJP connector (over which ajp_cping_cpong operates) is itself started.  In the AS, the connectors are the very last things to start - this is evident in the AS log.  So, for the time being - ignore these messages.  A workaround for this would be to defer all mod_cluster startup until the connectors are started.

                I had one more thing to ask. Httpd for load-balancing must be using some scheduling policy like round robin etc etc. If I want to make my own scheduling policy where i want to use the knowledge of the requested url/content to redirect the request, where should i start?? Which files do I need to modify in the httpd (one with mod_cluster enabled) to start with this? Also how can i use the information provided by the back end nodes(Jboss servers in my case) to make a more informed decision to schedule the requests? Also where does one give the scheduling policy to httpd which it uses to dispatch the requests to the backend nodes or it only has one scheduling policy which i will need to replace for my scenario? Any sample program will be really helpful.

                In mod_cluster, load balance scheduling is based on the load factors published by each node.  By default, these are calculated by the DynamicLoadBalanceFactorProvider bean (defined in mod_cluster-jboss-beans.xml).  To completely override the logic of providing the proxy with a load factor, you would either contribute to ModClusterService a custom implementation of LoadBalanceFactorProvider, or replace the default LoadMetrics used by DynamicLoadBalanceFactorProvider with your own LoadMetric implementation.

                This is discussed at length here:

                http://www.jboss.org/mod_cluster/java/load.html

                 

                Currently, mod_cluster assumes that, load permitting, a given request can be handled by any node on which the target application resides.  As far as support for routing traffic based on individual request parameters - I do not see how this can easily be achieved.  What is the use case for this?  Perhaps Jean-Frederic Clere can comment on this further.

                1 of 1 people found this helpful
                • 5. Re: cannot set up mod_cluster using (following http://www.jboss.org/mod_cluster/quick-start.html)
                  jfclere

                  About "load balance scheduling" it uses a "byrequests" loadbalancing (a modified find_best_byrequests from Apache httpd mod_balancer).

                  Actually it is not possible to use your own as the mod_cluster one is called directly. Notes that having your own also should mean you could use the Apache httpd mod_balancer ones that requires changes in both mod_balancer and mod_cluster.