负载平衡群集无法与Apache HTTP Server 2.4.6和JBoss EAP 7一起使用 [英] Load Balancing Cluster not working with Apache HTTP Server 2.4.6 and JBoss EAP 7

查看:109
本文介绍了负载平衡群集无法与Apache HTTP Server 2.4.6和JBoss EAP 7一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在JBoss EAP 7上认证我的应用程序.我的应用程序在独立模式下工作,但是在集群模式下,我的应用程序已部署,但是我无法登录.我再次重新路由到登录URL.
我有使用mod_cluster的安装集群.

I am certifying my application on JBoss EAP 7. My application works on standalone mode but in cluster mode, my application gets deployed but I am unable to login. I am again re-routed to login url.
I have setup cluster using mod_cluster.

Load Balancer Server中没有错误日志,也不在群集的各个节点上记录日志.
在我的测试环境中,我的负载均衡器和2个服务器节点位于同一台计算机上.我为JBoss节点提供了不同的端口和实例ID,以区分节点.
我正在共享来自集群中节点之一的mod_cluster.conf和JBoss standalone-ha.xml摘录.提前谢谢..
请不要否决该问题,请在评论中发送任何建议以改正该问题.

There is no error log in Load Balancer Server logs neither on individual nodes of the cluster.
In my test environment, my load balancer and 2 server nodes are on same machine. I have given JBoss nodes different ports and instance-ids to differentiate the nodes.
I am sharing my mod_cluster.conf and JBoss standalone-ha.xml extracts from one of the nodes in cluster. Thanks in advance..
Please do not downvote the question, please send any suggestions in comments to rephrase the question.

以下是Standalone-ha.xml文件中的片段:

Modcluster设置为:

Modcluster settings are:

    <subsystem xmlns="urn:jboss:domain:modcluster:2.0">
    <mod-cluster-config advertise-socket="modcluster" proxies="proxy1" balancer="testcluster" advertise="true" connector="ajp">
        <dynamic-load-provider>
            <load-metric type="busyness"/>
        </dynamic-load-provider>
    </mod-cluster-config>  
</subsystem> 

下排设置为:

    <subsystem xmlns="urn:jboss:domain:undertow:3.1" instance-id="node1">
    <buffer-cache name="default"/>
    <server name="default-server">
        <ajp-listener name="ajp" socket-binding="ajp"/>
        <http-listener name="default" socket-binding="http" redirect-socket="https"/>
         <host name="default-host" alias="localhost">
            <location name="/" handler="welcome-content"/>
            <filter-ref name="server-header"/>
            <filter-ref name="x-powered-by-header"/>
        </host>
    </server>
   <servlet-container name="default">
        <jsp-config/>
        <websockets/>
    </servlet-container>
    <handlers>
        <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
    </handlers>
    <filters>
        <response-header name="server-header" header-name="Server" header-value="JBoss-EAP/7"/>
        <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
    </filters>
</subsystem>

套接字绑定组的内容为:

Contents of Socket Binding Group are:

<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
    <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
    <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/>
    <socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>
    <socket-binding name="http" port="${jboss.http.port:8080}"/>
    <socket-binding name="https" port="${jboss.https.port:8443}"/>
    <socket-binding name="jgroups-mping" interface="private" port="0" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45700"/>
    <socket-binding name="jgroups-tcp" interface="private" port="7600"/>
    <socket-binding name="jgroups-tcp-fd" interface="private" port="57600"/>
    <socket-binding name="jgroups-udp" interface="private" port="55200" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45688"/>
    <socket-binding name="jgroups-udp-fd" interface="private" port="54200"/>
    <socket-binding name="modcluster" port="0" multicast-address="224.0.1.105" multicast-port="23364"/>
    <socket-binding name="txn-recovery-environment" port="4712"/>
    <socket-binding name="txn-status-manager" port="4713"/>
    <outbound-socket-binding name="mail-smtp">
        <remote-destination host="localhost" port="25"/>
    </outbound-socket-binding>
    <outbound-socket-binding name="proxy1"> 
    <!-- host and port number of the load-balancer.  -->
        <remote-destination host="x.x.x.x" port="81"/>
    </outbound-socket-binding>
 </socket-binding-group>

mod_cluster.conf的内容如下:

LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
LoadModule cluster_slotmem_module modules/mod_cluster_slotmem.so
LoadModule manager_module modules/mod_manager.so
LoadModule advertise_module modules/mod_advertise.so

MemManagerFile "//httpd2.4.6Home/var/cache/mod_cluster"

<IfModule manager_module>
    Listen 81
    <VirtualHost *:81>
    <Directory />
        Require all granted
    </Directory>
    <Location />
        Require all granted
    </Location>
    <Location /mod_cluster_manager>
        SetHandler mod_cluster-manager
        Require all granted
    </Location>
        KeepAliveTimeout 60
        MaxKeepAliveRequests 0
        ManagerBalancerName testcluster
        AdvertiseFrequency 5
        ServerAdvertise on
        EnableMCPMReceive
    </VirtualHost>
</IfModule>

推荐答案

基本上,您有两个选择-使用JBoss自己的domain模式创建集群,或者扩展您的独立配置以包含会话复制和sso所需的元素.

Basically you have two options - either create a cluster using JBoss own domain mode or extend you standalone configuration to contain required elements for session replication and sso.

在域模式下,大多数配置已经在EAP7中-只需扩展domain-full-ha配置文件即可.

In domain mode, most of the configurations are already present in EAP7 - just extend domain-full-ha profile.

所需的更改包括在Web应用程序web.xml中启用distributable标志-只需将<distributable/>添加到web.xml中即可. 接下来,将单点登录标志添加到您的undertow系统:

Required changes include enabling distributable flag in your web app web.xml - simply add <distributable/> to your web.xml. Next add single sign on flag to your undertow system:

  <host name="default-host" alias="localhost">                                                           
     <location name="/" handler="welcome-content"/>                                                     
     <filter-ref name="server-header"/>                                                                 
     <filter-ref name="x-powered-by-header"/>                                                           
     <single-sign-on/>    <!-- FIXME:  enable SSO here -->                                                                              
   </host>   

并启用集群SSO所需的缓存容器-如果仅扩展了standalone-ha配置文件,则这需要Infinishpan子系统,您现在可能拥有该子系统.如果看不到Infinispan子系统,请查看standalone-full-ha配置文件的standalone-full.如果还没有,请添加web缓存:

And enable cache container required for clustered SSO to work - this requires Infinishpan subsystem, which you might now have, if you only extended standalone-ha profile. If you do not see Infinispan subsystem, have a look at standalone-full of standalone-full-ha profiles. If you do not have it already, add web cache:

 /subsystem=infinispan/cache-container=web/distributed-cache=concurrent:add
 /subsystem=infinispan/cache-container=web/distributed-cache=concurrent/store=file:add 

同样,如果您使用独立模式或域模式的全功能配置文件,则可能已经拥有这些配置文件.

Again, if you use full-ha profile of either standalone or domain mode, you will probably have these already.

如果不使用JBoss安全域进行授权,也不要提及.如果您使用某些自定义身份验证机制,请确保正确设置了会话Cookie或令牌-用于正确的域和上下文等.

Also you do not mention, if you use JBoss security domain for authorization or not. In case you use some custom auth mechanism, make sure you set the session cookie or tokens correctly - for correct domain and context etc.

这篇关于负载平衡群集无法与Apache HTTP Server 2.4.6和JBoss EAP 7一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆