[wildfly-dev] 2 instance cluster in master/slave

Jason Greene jason.greene at redhat.com
Fri May 30 11:47:36 EDT 2014


On May 29, 2014, at 10:26 PM, Arun Gupta <arun.gupta at gmail.com> wrote:

> On Thu, May 29, 2014 at 8:22 PM, Jason T. Greene <jgreene at redhat.com> wrote:
>> 
>> 
>> Sent from my iPhone
>> 
>>> On May 28, 2014, at 4:24 PM, Arun Gupta <arun.gupta at gmail.com> wrote:
>>> 
>>> 
>>> FWIW I've been using port hopping to show session replication, without
>>> any LB in the front. Does that matter ?
>> 
>> Did you ever get help on this?
> 
> Nope.

Ah your problem is the session id cookie domain (see below)

> 
> I've been able to install Apache2 on Raspi but seems like mod_cluster
> is not available for ARM. And so I've been trying to build mod_cluster
> on Raspi and now debugging:
> 

-snip-

A couple other options that would be fun to play with:

1. Using Undertow’s reverse proxy like this (assuming you named the nodes pi1, pi2, and thus they have a pi1, pi2 jvmroute, which defaults to the host name if you didn’t set it):

 <reverse-proxy name="reverse-proxy" connections-per-thread=“20">
      <host name=“http://p1.example:8080" instance-id=“pi1”/>
      <host name=“http://p2.example:8080" instance-id=“pi2"/>
 </reverse-proxy>

2. You could also use undertow 1.1 standalone which has a mod_cluster impl (coming to WildFly soon)

https://github.com/undertow-io/undertow/blob/master/examples/src/main/java/io/undertow/examples/reverseproxy/ModClusterProxyServer.java

(requires alteration for your topology)


> 
> 
>> 
>> I would double check that you can see replication events happening, perhaps it's still a network issue.
> 
> What log messages am I looking for ?

You can just use wireshark (which has a jgroups decoder now i think), and look for traffic when you make changes, but this likely isn’t your problem.

> 
>> 
>> Also you might want to verify your session cookie is actually matching both locations. You might have two different sessions.
> 
> The session ids are indeed different. Just pushed out the latest blog
> in this series at:
> 
> http://blog.arungupta.me/2014/05/wildfly-managed-domain-raspberrypi-techtip27/
> 
> The session id are shown towards the end in screen snapshots, and are
> indeed different.

So the problem is you need to either have a shared cookie domain, or use an LB, since the cookie domain has to match the URL for the browser to send the same cookie. You can do this in either the global config (standalone.xml under servlet-container), or you can add a setting to your web.xml like this:

<session-config>
   <cookie-domain>.example</cookie-domain>
</session-config>

Then you want to add host entries to hosts:

pi1.example 10.x.x.x
pi2.example 10.x.x.x


After you do that you should be able to stick pi1.example and pi2.example in the browser.

--
Jason T. Greene
WildFly Lead / JBoss EAP Platform Architect
JBoss, a division of Red Hat




More information about the wildfly-dev mailing list