[wildfly-dev] 2 instance cluster in master/slave
Jason Greene
jason.greene at redhat.com
Tue Jun 3 11:16:00 EDT 2014
Very cool. Did you ever give the wildfly as a proxy approach a try?
On May 31, 2014, at 8:37 PM, Arun Gupta <arun.gupta at gmail.com> wrote:
> Please help spread the word.
>
> Let me know if you have fun ideas/projects that should run on Raspi
> and help us build thought leadership :-)
>
> Arun
>
> On Sat, May 31, 2014 at 7:47 AM, David Aroca <daviaro at gmail.com> wrote:
>> Thnks Arun!
>>
>>
>> 2014-05-31 3:29 GMT-05:00 Kabir Khan <kabir.khan at jboss.com>:
>>>
>>> Nice!
>>> On 31 May 2014, at 05:10, Arun Gupta <arun.gupta at gmail.com> wrote:
>>>
>>>> And finally, the three-part article showing how to setup WildFly
>>>> cluster on Raspberry Pi is now available at:
>>>>
>>>> http://blog.arungupta.me/2014/05/wildfly-cluster-raspberrypi-techtip28/
>>>>
>>>> Feedback always welcome!
>>>>
>>>> Weekend can now start :)
>>>>
>>>> Cheers
>>>> Arun
>>>>
>>>>
>>>> On Fri, May 30, 2014 at 5:58 PM, Jason T. Greene <jgreene at redhat.com>
>>>> wrote:
>>>>>
>>>>>
>>>>> Sent from my iPhone
>>>>>
>>>>>> On May 30, 2014, at 6:44 PM, Arun Gupta <arun.gupta at gmail.com> wrote:
>>>>>>
>>>>>> One (hopefully) last bit...
>>>>>>
>>>>>> How/where do I set the sticky session ?
>>>>>
>>>>> If you are using mod_proxy there is a memory based sticky session
>>>>> parameter you have to set to JSESSIONID, see the apache page.
>>>>>
>>>>>
>>>>>>
>>>>>> Arun
>>>>>>
>>>>>>> On Fri, May 30, 2014 at 11:27 AM, Jason Greene
>>>>>>> <jason.greene at redhat.com> wrote:
>>>>>>>
>>>>>>> On May 30, 2014, at 12:54 PM, Arun Gupta <arun.gupta at gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>>>
>>>>>>>>> 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>
>>>>>>>>
>>>>>>>> Where will I add this fragment ?
>>>>>>>
>>>>>>> In your domain.xml define a new profile called proxy, which is
>>>>>>> derived from the “default" profile.
>>>>>>>
>>>>>>> In your new profile under the undertow subsystem, in the handlers
>>>>>>> section, below the welcome content file handler, add the above proxy config.
>>>>>>> You then need to change the location name=“/“ to point to the
>>>>>>> “reverse-proxy” handler (instead of “welcome-content”)
>>>>>>>
>>>>>>> You basically want 3 server instances, one proxy, web server 1, and
>>>>>>> web server 2, all preferably on separate systems. The proxy would be
>>>>>>> assigned the proxy profile, the two other servers would get ha profiles.
>>>>>>>
>>>>>>> You could have your DC collocated on the proxy or on a separate box.
>>>>>>> You need to be sure that your instance-id matches the jvm route on the web 1
>>>>>>> and 2 boxes (defaults to hostname) for sticky sessions to work properly. If
>>>>>>> you look at the cookie value you will see the jvmroute as a suffix.
>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> 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)
>>>>>>>> OK, let me try the simpler route first.
>>>>>>>>
>>>>>>>> I'm having issues building mod_cluster on ARM and following up on
>>>>>>>> that
>>>>>>>> separately. Seems like I may have to use mod_proxy for now since
>>>>>>>> this
>>>>>>>> is baked into Apache2 for ARM.
>>>>>>>>
>>>>>>>>>> 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>
>>>>>>>>
>>>>>>>> Can this element be added to domain.xml as well for the managed
>>>>>>>> domain mode ?
>>>>>>>
>>>>>>> Yes next to the “server” block inside the undertow subsystem you can
>>>>>>> add:
>>>>>>>
>>>>>>> <servlet-container>
>>>>>>> <session-cookie domain=“.example”>
>>>>>>> </servlet-container>
>>>>>>>
>>>>>>> Although note that you ONLY have to do this if you are not using an
>>>>>>> LB.
>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> Then you want to add host entries to hosts:
>>>>>>>>>
>>>>>>>>> pi1.example 10.x.x.x
>>>>>>>>> pi2.example 10.x.x.x
>>>>>>>>
>>>>>>>> These entries would be made in each individual /etc/hosts ?
>>>>>>>
>>>>>>> You just need this on the machine with the client browser, so that
>>>>>>> when it sends HTTP requests it does “Host: pi1.example” instead of "Host:
>>>>>>> 10.xxxxx”.
>>>>>>>
>>>>>>> If you decide to go the LB route, and want to have name references
>>>>>>> then you could do them everywhere to make it all easy.
>>>>>>>
>>>>>>>>
>>>>>>>> Arun
>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> 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
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> http://blog.arungupta.me
>>>>>>>> http://twitter.com/arungupta
>>>>>>>
>>>>>>> --
>>>>>>> Jason T. Greene
>>>>>>> WildFly Lead / JBoss EAP Platform Architect
>>>>>>> JBoss, a division of Red Hat
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> http://blog.arungupta.me
>>>>>> http://twitter.com/arungupta
>>>>
>>>>
>>>>
>>>> --
>>>> http://blog.arungupta.me
>>>> http://twitter.com/arungupta
>>>
>>>
>>> _______________________________________________
>>> wildfly-dev mailing list
>>> wildfly-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/wildfly-dev
>>
>>
>
>
>
> --
> http://blog.arungupta.me
> http://twitter.com/arungupta
--
Jason T. Greene
WildFly Lead / JBoss EAP Platform Architect
JBoss, a division of Red Hat
More information about the wildfly-dev
mailing list