Wildfly 集群和 Apache2

Wildfly cluster and Apache2

我浏览了很多,我看到这个问题与其他已经发布的问题类似,但解决方案似乎不适用于我的情况。我建立了一个 Wildfly.8.2.0.Final 集群,我想把它放在 httpd 后面,集群是 运行ning 正确。在我的主机上,我 运行 三个 Debian Wheezy 来宾,其中两个 运行 一个集群的节点(IP 是 192.168.0.101192.168.0.102)另一个来宾 运行 Apache2。 2.22 带有 mod_cluster.1.2.0.Final 模块。这是我的 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>

模块已正确加载,我可以在 192.168.0.104:6666/mod_cluster_manager 上看到 mod_cluster 的管理器页面,但没有节点信息。我还配置了一个虚拟主机:

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 距离是 运行 通过使用默认的独立 - ha.xml。这是命令:

./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

命令指的是第一位客人。随着节点的增加,Apache2 mod_cluster_manager 页面没有变化,而且,如果我查找 192.168.0.104/MyClusteredApp/,我会收到 404 错误。如果我直接在节点上使用 curl,一切都会按预期进行。我的配置有什么问题?

更新: 我在我的虚拟主机文件中添加了这一行 ServerAdvertise On 192.168.0.104 并以这种方式更改了一行 ManagerBalanceName other-server-group 。现在我可以看到节点和 apache2 尝试通信但没有成功。在 apache2 虚拟主机的 error.log 上,我看到了这个:

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

更新: 我在 ManagerBalanceName wfycluster 中更改 ManagerBalanceName other-server-group,并注释行 ProxyPass ..ProxyPassReverse..ProxyPreserveHost.. 关于我的虚拟主机配置。我还更改了我的 Wildfly 节点配置,将属性 balancer=wfycluster 添加到 modcluster 子系统中的 mod-cluster-config 标记。

中的错误已更改
...(UndertowEventHandlerAdapter - 1) MODECLUSTER000042: Error null sending INFO command to debian1-2.local/192.168.0.104:6666, configuration will be reset: null

您尝试过不使用 ProxyPass 指令吗?我不确定你是否需要这些。

这是我成功使用的基本概念验证配置:

<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>

我搞乱了 Apache2 虚拟主机配置。我这样更改 mod_cluster.conf

<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>

并尽可能简单地更改另一个虚拟主机:

<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 属性 balancer 值和 mod_cluster 虚拟主机 ManagerBalancerName 现在匹配。我终于可以在 mod_cluster-manager 页面上看到节点了。也许不是最好的配置,我必须深入挖掘,但它确实有效。感谢@Bruno 为我指明了正确的方向。