2015-01-12 164 views
0

我浏览了很多,我发现这个问题与其他已发布的类似,但解决方案似乎不适用于我的情况。我构建了一个Wildfly.8.2.0.Final集群,我想把它放在httpd后面,集群运行正常。在我的主机上,我运行了三个Debian Wheezy guest虚拟机,其中两个运行集群的节点(IP为192.168.0.101192.168.0.102),另一个guest虚拟机使用mod_cluster.1.2.0.Final模块运行Apache2.2.22。这是我的mod_cluster.conf:蜻蜓群集和Apache2

<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的管理器页面。我还配置了一个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使用默认的standalone-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 wfyclusterManagerBalanceName other-server-group和注释行ProxyPass ..ProxyPassReverse..,并ProxyPreserveHost..我的虚拟主机配置。我还改变了我的Wildfly节点配置,在modcluster子系统中添加属性balancer=wfyclustermod-cluster-config标记。错误更改

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

回答

0

我用的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页面上的节点。也许不是最好的可能,我必须深入挖掘,但它可行。谢谢@布鲁诺指出我正确的方向。

1

您是否尝试过没有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> 
+0

我评论了'ProxyPass..','ProxyPassReserve..'和'ProxyPreserveHost..'这两行。错误在'...(UndertowEventHandlerAdapter - 1)MODECLUSTER000042:发送INFO命令到debian1-2.local/192.168.0.104:6666时发生错误,配置将被重置为空。 – Francesco

+1

你的apache配置中有这两个VirtualHost条目吗?你能解释第二个目标是什么吗? – Bruno

+1

另外,你有没有完成/验证蜻蜓侧的配置? – Bruno