0

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.

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.

Following are the snippets in standalone-ha.xml file:

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>   

Undertow settings are:

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

Contents of mod_cluster.conf are as follows:

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>  
1
  • It looks like a sticky session issue, but I have not found this issue mentioned in any jboss forums. Is this a configuration issue? Apr 28, 2017 at 11:55

1 Answer 1

2

This does look like session stickiness issue.

IMHO your configuration seems ok. Can you perform curl call on your app? Or just some JSP page to verify your configuration.

curl -b cookie.txt -c cookie.txt YOUR_BALANCER_ADDRESS/YOURAPP -v

Can you perform curl call on your app? Or just some JSP page to verify your configuration.

curl -b cookie.txt -c cookie.txt YOUR_BALANCER_ADDRESS/YOURAPP -v

Or use this groovy script

final char CR = '\r'
final char LF = '\n'
String host = (args.size() >= 1) ? args[0] : '127.0.0.1'
int port = (args.size() >= 2) ? Integer.parseInt(args[1]) : 8080
String path = (args.size() >= 3) ? args[2] : "/clusterbench/jvmroute"
Socket socket
OutputStreamWriter out
InputStream ins
BufferedReader reader
try {
    socket = new Socket(host, port)
    def req = "GET ${path} HTTP/1.1" + CR + LF +
          "Host: ${host}:${port}" + CR + LF +
          'Accept: */*' + CR + LF +
          'Connection: close' + CR + LF + CR + LF
    println "Sending request \n" + req
    socket = new Socket(host, port)
    out = new OutputStreamWriter(socket.getOutputStream(), "UTF-8")
    out.write(req)
    out.flush()
    ins = socket.getInputStream()
    reader = new BufferedReader(new InputStreamReader(ins))
    reader.readLines().each { line ->
            println line
    }
} catch (Exception ex) {
    println "Exception: " + ex
} finally {
    socket?.close()
    out?.close()
    reader?.close()
}

Usage is:

groovy test.groovy IP_ADDRESS PORT PATH_TO_APP

Example:

groovy test.groovy 127.0.0.1 2080 "/clusterbench/jvmroute"

Output: Sending request GET /clusterbench/jvmroute HTTP/1.1 Host: 192.168.122.206:2080 Accept: / Connection: close

HTTP/1.1 200 OK
Date: Wed, 07 Jun 2017 08:18:03 GMT
Server: JBoss-EAP/7
X-Powered-By: Undertow/1
Set-Cookie: JSESSIONID=TK454oHgFFX05Duw7LxTS3bO4JyyMLcqrqv5IWm_.jboss-eap-7.1-2; path=/clusterbench
Content-Type: text/plain;charset=UTF-8
Content-Length: 15
Connection: close

We are looking for "Set-Cookie:" header to verify that worker node correctly set sessionId and it's jvm route.

If he does, then issue will be elsewhere

Mod-cluster manager console output might help too.

Nothing specific comes to my mind.

  • You run 2 EAPs, without specifying names, on the same machine and they are not clustered. Mod-cluster manager console output will show that. EAP log output might help too

  • EAP node don't set jvmRoute and They are not clustered (curl, EAP log might help)

  • Your app don't set sessionID (random JSP page curl request might help)

Sorry i cannot be more helpful

3
  • Thanks for your reply. The nodes are in cluster, the manager console shows both nodes. The jvm route is maintained. The problem lies in sticky session. Even if the sticky session is set to true in both EAPs configuration. This configuration works fine on EAP 6.x but fails on EAP 7.0. Jun 6, 2017 at 13:13
  • Updated answer with groovy script if you don't have curl. Could you send a request so we can see if worker node correctly set sessionId? Jun 7, 2017 at 8:26
  • Hi can you refer to my question asked on JBoss Forum. developer.jboss.org/thread/274821 Jun 14, 2017 at 12:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .