5 Replies Latest reply on Jan 14, 2015 10:13 AM by rhusar

    Wildfly cluster and Apache2

    fpezzati

      Hello,

       

      I'm running three Debian Wheezy guests on my host. Two of them run a Wildfly.8.2.0.Final cluster's node (IP are 192.168.0.101 and 192.168.0.102) the other guest run Apache2.2.22 with mod_cluster.1.2.0.Final module. This is my mod_cluster.conf:


      <IfModlue mod_manager.so>
        Listen 192.168.0.104:6666
        ManagerBalancerName wfycluster
        <VirtualHost 192.168.0.104:6666>
        KeepAliveTimeout 300
        MaxKeepAliveRequests 0
        AdvertiseFrequency 5
        ServerAdvertise On 192.168.0.104:6666
        EnableMCPMReceive
        <Location /mod_cluster-manager>
        SetHandler mod_cluster-manager
        Order deny,allow
        Deny from all
        Allow from 192.168.0
        </Location>
        </VirtualHost>
      </IfModule>


      Modules are loaded correctly and I can see the mod_cluster's manager page on 192.168.0.104:6666/mod_cluster_manager but with no nodes info. I also configured a VirtualHost:


      Listen 192.168.0.104:6666
      <VirtualHost 192.168.0.104:6666>
        ServerName wfycluster
        ProxyPass / balancer://wfycluster
        ProxyPassReverse / balancer://wfycluster
        ProxyPreserveHost On 192.168.0.104
        <Location />
        Order deny,allow
        Allow from 192.168.0
        </Location>
        SetHandler mod_cluster-manager
        ManagerBalancerName other-server-group
        ErrorLog /var/log/apache2/wfycluster/error.log
      </VirtualHost>


      I run Wildfly istances by using the default standalone-ha.xml. This is the command:


      ./standalone.sh -b 192.168.0.101 -c standalone-ha.xml -Djboss.node.name=srv1 -u 230.0.0.4 -Djboss.bind.address.unsecure=192.168.0.101 -Djboss.bind.address.management=192.168.0.101


      As nodes rises up there is no change in the Apache2 mod_cluster_manager page and I can see in virutal host's error log a lot of this messages:


      ...[error] proxy: CLUSTER: (balancer://wfycluster). All workers are in error state


      The cluster is running correctly, I tested with curl directly on nodes.

        • 1. Re: Wildfly cluster and Apache2
          rhusar

          Modules are loaded correctly and I can see the mod_cluster's manager page on 192.168.0.104:6666/mod_cluster_manager but with no nodes info. I also configured a VirtualHost:


          So even after you start the cluster, you can't see any nodes added to the manager page?

           

            ManagerBalancerName wfycluster

          Most likely, did you also configure the same name for balancer in WildFly and reload?

           

          [rhusar@x220 wildfly-8.1.0.Final]$ ./bin/jboss-cli.sh -c
          [standalone@localhost:9990 /] /subsystem=modcluster/mod-cluster-config=configuration:write-attribute(name=balancer,value=wfycluster)
          {
              "outcome" => "success",
              "response-headers" => {
                  "operation-requires-reload" => true,
                  "process-state" => "reload-required"
              }
          }
          [standalone@localhost:9990 /] :reload
          {
              "outcome" => "success",
              "result" => undefined
          }
          
          

           

          Try adding a debug log to apache as well if that fails:

           

          LogLevel debug
          
          
          • 2. Re: Wildfly cluster and Apache2
            fpezzati

            Hello,

            I can't see no nodes in mod_cluster-manager page. I change my virtual host configuration this way:

             

            Listen 192.168.0.104:6666

            <VirtualHost 192.168.0.104:6666>

                 ServerName wfycluster

                 <Location />

                 </Location>

                 SetHandler mod_cluster-manager

                 ManagerBalancerName wfycluster

                 ServerAdvertise On 192.168.0.104:6666

                 LogLevel debug

                 ErrorLog /var/log/apache2/wfycluster/error.log

            </VirtualHost>

             

            I also add balancer=wfycluster attribute to mod-cluster-config tag in mod-cluster subsystem. Now Wildfly nodes report this error:

             

            ...(UndertowEventHandlerAdapter - 1) MODECLUSTER000042: Error null sending INFO command to debian1-2.local/192.168.0.104:6666, configuration will be reset: null

             

            and Apache2's virtual host return this errors:

             

            ... [client 192.168.0.101] Invalid method in request INFO / HTTP/1.1

            ... [client 192.168.0.102] Invalid method in request INFO / HTTP/1.1

            ...

             

            192.168.0.101 and 192.168.0.102 are Wildfly nodes ip addresses. Still no nodes on the mod_cluster-manager page. Maybe I'm doin' some mess with configuration.

            • 3. Re: Re: Wildfly cluster and Apache2
              rhusar

              Listen 192.168.0.104:6666

              <VirtualHost 192.168.0.104:6666>

                  ServerName wfycluster

                  <Location />

                  </Location>

                  SetHandler mod_cluster-manager

                  ManagerBalancerName wfycluster

                  ServerAdvertise On 192.168.0.104:6666

                  LogLevel debug

                  ErrorLog /var/log/apache2/wfycluster/error.log

              </VirtualHost>


              You are missing EnableMCPMReceive directive, thus this request is opaque and results in "Invalid method in request".

              1 of 1 people found this helpful
              • 4. Re: Wildfly cluster and Apache2
                fpezzati

                I was messing with Apache2 virtualhost configurations. I change my mod_cluster.conf this way:

                <IfModule manager_module>

                Listen 192.168.0.104:6666

                ManagerBalancerName wfycluster

                <VirtualHost 192.168.0.104:6666>

                AllowDisplay On

                KeepAliveTimeout 300

                MaxKeepAliveRequests 0

                AdvertiseFrequency 5

                ServerAdvertise On 192.168.0.104:6666

                AdvertiseGroup 224.0.1.105:23364

                EnableMCPMReceive

                <Location />

                Order allow,deny

                # Deny from all

                Allow from 192.168.0.

                </Location>

                <Location /wfycluster>

                SetHandler mod_cluster-manager

                Order deny,allow

                Allow from 192.168.0

                </Location>

                </VirtualHost>

                </IfModule>

                and change the other one virtualhost as simple as possible:

                <VirtualHost *:80>

                ServerName wfycluster

                <Location />

                Order deny,allow

                Allow from 192.168.0.

                </Location>

                LogLevel debug

                ErrorLog /var/log/apache2/wfycluster/error.log

                </VirtualHost>

                Wildfly attribute balancer value and mod_cluster virtualhost ManagerBalancerName now matches. I can finally see nodes on mod_cluster-manager page. Maybe not the best conf possible, I have to dig deeper, but it works. Thanks for the help.

                • 5. Re: Re: Wildfly cluster and Apache2
                  rhusar

                  Great.

                   

                  Just make sure to remove the debug log level and consider adding advertise-security-key / advertiseSecurityKey configuration before going public with the setup.