Francesco
Francesco

Reputation: 1802

Wildfly cluster and Apache2

I browse a lot, I see this question is similar to other already posted but solutions seem not working in my case. I built a Wildfly.8.2.0.Final cluster and I want to put it behind httpd, cluster is running correctly. On my host I run three Debian Wheezy guests, two of them run a 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
  <Location />
    Order deny,allow
    Allow from 192.168.0
  </Location>
  SetHandler mod_cluster-manager
  ManagerBalancerName wfycluster
  ErrorLog /var/log/apache2/wfycluster/error.log
</VirtualHost>

Wildfly istances are run 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

command refers to first guest. As nodes rises up there is no change in the Apache2 mod_cluster_manager page, and, if I look for 192.168.0.104/MyClusteredApp/ I get a 404 error. If I use curl directly on nodes everything works as expected. What's wrong in my configuration?

UPDATE: I add this line ServerAdvertise On 192.168.0.104 and changed a line in this way ManagerBalanceName other-server-group in my virtual host file. Now I can see nodes and apache2 try to communicate but with no success. On apache2 virtual host's error.log I see this:

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

UPDATE: I change ManagerBalanceName other-server-group in ManagerBalanceName wfycluster, and commented lines ProxyPass .., ProxyPassReverse.., and ProxyPreserveHost.. about my virtualhost configuration. I also changed my Wildfly nodes configuration adding attribute balancer=wfycluster to mod-cluster-config tag in modcluster subsystem. Error changed in

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

Upvotes: 1

Views: 2516

Answers (2)

Francesco
Francesco

Reputation: 1802

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 @Bruno for pointing me in the right direction.

Upvotes: 0

Bruno
Bruno

Reputation: 94

Have you tried without the ProxyPass directives? I am not certain you need those.

This is the basic proof of concept config I have used successfully:

<VirtualHost [HOST]:[PORT]>
    AllowDisplay On
    EnableMCPMReceive
    #allow access from cluster nodes to the mod_cluster module
    <Directory />
        Order deny,allow
        Deny from all
        Allow from [SUBNET/VPN/... where the nodes are]
    </Directory>

    KeepAliveTimeout 60
    MaxKeepAliveRequests 0
    AdvertiseFrequency 5
    ServerAdvertise On http://[HOST]:[PORT] 

    # This directive allows you to view mod_cluster status at URL http://[HOST]:[PORT]/mod-cluster-manager
    <Location /mod-cluster-manager>
        SetHandler mod_cluster-manager
        Order deny,allow
        Deny from all
        Allow from [SUBNET/VPN/... from which you want to access mod-cluster manager page]
    </Location>
</VirtualHost>

Upvotes: 1

Related Questions