tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rüdiger Herrmann <rherrm...@eclipsesource.com>
Subject Re: How to cluster two embedded tomcat 7 instances
Date Fri, 10 Jun 2011 20:23:16 GMT
In case someone is interested, the code to programmatically set up a
clustered Tomcat instance is attached.

- Rüdiger

On Fri, Jun 10, 2011 at 10:42, Rüdiger Herrmann
<rherrmann@eclipsesource.com> wrote:
> Martin,
>
> thanks for the pointers. Though, I'd rather like to start with the
> default solution (i.e. something that works out of the box with the
> Tomcat deliverable)
> In the meanwhile, I brought the SimpleTcpCluster to work. I will
> report here soon with some code.
>
> Still, I would be *very* interested in knowing how to use the
> PersistentManager to realize session failover - if it is inteded to
> serve that purpose at all.
>
> Regards
> Rüdiger
>
> On Thu, Jun 9, 2011 at 16:16, Martin Grotzke
> <martin.grotzke@googlemail.com> wrote:
>> Hi,
>>
>> perhaps memcached-session-manager is an option for you:
>> http://code.google.com/p/memcached-session-manager/
>>
>> It has integration tests that show how to configure it programatically:
>> https://github.com/magro/memcached-session-manager/blob/master/core/src/test/java/de/javakaffee/web/msm/integration/TestUtils.java#L440
>>
>> Configuration options are described here:
>> http://code.google.com/p/memcached-session-manager/wiki/SetupAndConfiguration
>>
>> Cheers,
>> Martin
>>
>>
>> On 06/09/2011 03:15 PM, Rüdiger Herrmann wrote:
>>> Hi all,
>>>
>>> I would like to programmatically set up two Tomcat engines and have
>>> them form a basic cluster - all in the same VM. Creating and starting
>>> the servlet engines already works
>>>   Tomcat tomcat = new Tomcat()
>>>   tomcat.setPort( 123 );
>>>   // create context, add servlet, ...
>>>   tomcat.start();
>>>
>>> What I am struggling with is setting up the cluster. My first attempt
>>> was to use the PersistentManager with Store that uses a shared
>>> directory. But it seems that it only persists session in time
>>> intervals. To enable failover, a session would need to be persisted
>>> after each request. However, I didn't find out how to configure or
>>> trigger the PersistentManager to do so.
>>> Still, the PersistenceManager setup was straightforward and if anyone
>>> knows how to form a cluster with this approach I would be grateful to
>>> know.
>>>
>>> I am aware of the SimpleTcpCluster, which I would try next. Just,
>>> before transforming the XML configuration into API calls (without
>>> known their meaning) I wanted to ask if there is an easier or even
>>> pre-built solution.
>>>
>>> Background:
>>> I work on enabling RAP [1], a web framework, to work in failover
>>> cluster environments. To ensure cluster-support, I have a set of JUnit
>>> tests that issue requests against an embeded cluster of servlet
>>> engines and then examine the state of sessions of the respective
>>> nodes, etc.
>>> Performance isn't important, neither is any advanced clustering
>>> feature (e.g. DeltaManager) needed. My focus is on finding a
>>> lightweight and purely programmatic solution.
>>>
>>> Thanks in advance,
>>> Rüdiger
>>>
>>> [1] http://eclipse.org/rap
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>
>> --
>> Martin Grotzke
>> http://twitter.com/martin_grotzke
>>
>>
>
>
>
> --
> --
> EclipseSource
> http://eclipsesource.com
> Tel: 0721 - 66 47 33 - 0
> Fax: 0721 - 66 47 33 29
>
> Innoopract Informationssysteme GmbH
> Stephanienstrasse 20, 76133 Karlsruhe, Germany
> General Manager: Jochen Krause
> Registered Office: Karlsruhe, Commercial Register Mannheim HRB 107883
>



-- 
--
EclipseSource
http://eclipsesource.com
Tel: 0721 - 66 47 33 - 0
Fax: 0721 - 66 47 33 29

Innoopract Informationssysteme GmbH
Stephanienstrasse 20, 76133 Karlsruhe, Germany
General Manager: Jochen Krause
Registered Office: Karlsruhe, Commercial Register Mannheim HRB 107883


Mime
View raw message