<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
JBoss clustering, mod_ajp and sticky sessions
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/willemnoorduin">Willem Noorduin</a> in <i>Beginner's Corner</i> - <a href="http://community.jboss.org/message/601585#601585">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>We have the following architecture:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>JBoss-EWS 1.0.1 on 192.168.0.1<br/>JBoss-AS  5.1.0 on 192.168.0.2 (jboss1) and 192.168.0.3 (jboss2)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>On the JBoss-AS's there are instances app_i1 on jboss1, and app_i2 on jboss2, and hose together form a cluster (the instances are based on the all profile, so clustering is on.</p><p>We have deployed a application app to these instances, such that we can run the application like:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><a class="jive-link-external-small" href="mailto:root@192.168.0.1">root@192.168.0.1</a> # lynx jboss1:8080/app<br/><a class="jive-link-external-small" href="mailto:root@192.168.0.1">root@192.168.0.1</a> # lynx jboss2:8080/app</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>To configure the commnication between the JBoss-EWS and our JBoss-AS cluster we have made a <br/>Virtual host copnfiguration:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><Proxy balancer://cluster/><br/>        BalancerMember ajp://jboss1:8009/app/ route="node1" loadfactor=1 ping=10 ttl=600<br/>        BalancerMember ajp://jboss2:8009/app/ route="node2" loadfactor=1 ping=10 ttl=600<br/></Proxy></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><VirtualHost *:80><br/>    ServerAdmin <a class="" href="http://community.jboss.org/mailto:aap@noot.mies">aap@noot.mies</a><br/>    DocumentRoot /apps/www.application.nl/data<br/>    ServerName <a class="jive-link-external-small" href="http://www.application.nl">www.application.nl</a><br/>    ErrorLog logs/www.application.nl-error_log<br/>    CustomLog logs/www.application.nl-access_log combined<br/>    LogLevel debug</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    ProxyTimeout 40<br/>    ProxyStatus On</p><p>    ProxyPass /app balancer://cluster/ stickysession=JSESSIONID|jsessionid timeout=10</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    <Location /balancer-manager><br/>        SetHandler balancer-manager<br/>    </Location></p><p></VirtualHost></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>We started this configuration successfully, but what we see is that everytime apache sends a request to for example jboss1, it gets its response from the other clusternode on jboss2, resulting in a 404 and a failure, The solution for this problem is obviously sticky sessions, but I can not get this working. I have tested the following things:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>A. Swiching back to good old mod_jk:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>workers.properties:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>#<br/># Connection to nlptc27b16 brpp cluster<br/>#</p><p>worker.node1.port=8009<br/>worker.node1.host=node1<br/>worker.node1.type=ajp13<br/>worker.node1.lbfactor=50</p><p>#<br/># Connection to nlptc27b17 brpp cluster<br/>#</p><p>worker.node2.port=8009<br/>worker.node2.host=node2<br/>worker.node2.type=ajp13<br/>worker.node2.lbfactor=50</p><p>#<br/># Loadbalancing behaviour<br/>#</p><p>worker.loadbalancer_cluster.type=lb<br/>worker.loadbalancer_cluster.balance_workers=node1,node2<br/>worker.loadbalancer_cluster.sticky_session=1</p><p><br/>I can get this to work (i.e. with the proper JkMounts I can reach the application via its url <a class="jive-link-external-small" href="http://www.application.nl/app">www.application.nl/app</a>). But when I call some functionality (for example login to the app), the same problem occurs. I can see (for example with http watch that the application sends it request to one server and receives the answer from the other. I think this is typical round robin without sticky session.</p><p><br/>B. Isolating one node</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>When I isolate one node in the mod_jk configuration, it does work allright, but obviously we want a cluster running.</p><p>When I isolate one node in the proxy_ajp configuration, it doesn't work, but I think I have some of the settings wrong.</p><p><br/><strong>Question</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Can you help me with the settings of JBoss-EWS / JBoss-AS and maybe the application itself ? I have read many solutions on the JBoss Community, but they are all for a wrong version (for example UseJK, which isn't needed anymore by 5.1.0) or they simply don't apply / work in our situation ?</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/601585#601585">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in Beginner's Corner at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>