apache + mod_cluster + wildfly on Ubuntu

apache + mod_cluster + wildfly on Ubuntu

我正在尝试使以下设置正常工作:

apache 2.4 + mod_cluster 1.3 Final + ubuntu 14.04.2-server + Wildfly 8.1.0 Final

并且我成功地将 wildfly 上下文广告到 apache,但是当我尝试访问负载平衡器时,我得到了 500。

此外,当我在启动 wildfly 后重新启动 apache 时,出现以下错误:

MODCLUSTER000042: Error MEM sending STATUS command to 192.168.56.101/192.168.56.101:10001, configuration will be reset: MEM: Can't read node

这是我的配置:

mod_cluster.conf

<IfModule manager_module>
   Listen *:10001
   ManagerBalancerName modcluster
   ProxyPass /cluster-demo balancer://modcluster stickysession=JSESSIONID|jsessionid nofailover=On
   ProxyPassReverse /cluster-demo balancer://modcluster
   ProxyPreserveHost On

<VirtualHost *:10001>

  <Location />
    Require all granted
  </Location>

  KeepAliveTimeout 60
  MaxKeepAliveRequests 0
  EnableMCPMReceive On
  AdvertiseFrequency 5
  ServerAdvertise On http://192.168.56.101:10001
  AdvertiseGroup 224.0.1.105:23364

  <Location /mod_cluster-manager>
   SetHandler mod_cluster-manager
   Require all granted
  </Location>

 </VirtualHost>

 <VirtualHost *:80>
   <Location />
     Require all granted
   </Location>
 </VirtualHost>

</IfModule>

mod_cluster.load

LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule slotmem_module /usr/lib/apache2/modules/mod_slotmem.so
LoadModule manager_module /usr/lib/apache2/modules/mod_manager.so
LoadModule proxy_cluster_module /usr/lib/apache2/modules/mod_proxy_cluster.so
LoadModule advertise_module /usr/lib/apache2/modules/mod_advertise.so

domain.xml

    ...
    ...
    <subsystem xmlns="urn:jboss:domain:modcluster:1.2">
                    <mod-cluster-config advertise-socket="modcluster" proxy-list="192.168.56.101:10001" \
    balancer="modcluster" excluded-contexts="invoker,jbossws,juddi,console" load-balancing-group="other-\
    server-group" connector="ajp">
                        <dynamic-load-provider>
                            <load-metric type="busyness"/>
                        </dynamic-load-provider>
                    </mod-cluster-config>
                </subsystem>
    ...
    ...
    <subsystem xmlns="urn:jboss:domain:modcluster:1.2">
                    <mod-cluster-config advertise-socket="modcluster" proxy-list="192.168.56.101:10001" \
    balancer="modcluster" excluded-contexts="invoker,jbossws,juddi,console" load-balancing-group="other-\
    server-group" connector="ajp">
                        <dynamic-load-provider>
                            <load-metric type="busyness"/>
                        </dynamic-load-provider>
                    </mod-cluster-config>
                </subsystem>

不确定我做错了什么,如有任何帮助,我们将不胜感激。谢谢。

首先尝试使用 Wildfly 8.2 而不是 8.1 :-)

Mod_cluster.load内容应该是这样的:

  LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so 
  LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so 
  LoadModule proxy_ajp_module_module /usr/lib/apache2/modules/mod_proxy_ajp.so 
  LoadModule cluster_slotmem_module /usr/lib/apache2/modules/mod_cluster_slotmem.so
  LoadModule manager_module /usr/lib/apache2/modules/mod_manager.so 
  LoadModule proxy_cluster_module/ usr/lib/apache2/modules/mod_proxy_cluster.so 
  LoadModule advertise_module /usr/lib/apache2/modules/mod_advertise.so

mod_cluster 1.3 中的 slotmem 已重命名为 "mod_cluster_slotmem"。 并且您的文件中缺少 ajp 代理模块。

启动 apache,您将在控制台中获得以下信息:

 [Fri May 08 12:31:02.213753 2015] [so:warn] [pid 7989:tid 140491011782528] AH01574: module proxy_module is already loaded, skipping
 [Fri May 08 12:31:02.213882 2015] [so:warn] [pid 7989:tid 140491011782528] AH01574: module proxy_http_module is already loaded, skipping

但是您需要在 mod_cluster.load 文件中保留 proxy_module 和 proxy_http_module。