You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Rüdiger Herrmann <rh...@eclipsesource.com> on 2011/06/09 15:15:26 UTC

How to cluster two embedded tomcat 7 instances

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


Re: How to cluster two embedded tomcat 7 instances

Posted by Martin Grotzke <ma...@googlemail.com>.
Hi Rüdiger,

On 06/10/2011 10:42 AM, Rüdiger Herrmann wrote:
> 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.
I remember there were people posting on this list that they're trying to
achieve the same without success (I just cannot find the relevant
threads in short time). You can search the mailing list for this (IIRC
one case was related to realizing non-sticky sessions with persistent
manager).

Cheers,
Martin


RE: How to cluster two embedded tomcat 7 instances

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Rüdiger Herrmann [mailto:rherrmann@eclipsesource.com] 
> Subject: Re: How to cluster two embedded tomcat 7 instances

> thanks for the hint. Here goes the link to the file:
> http://pastebin.com/6K4Ns4Tz

Please consider adding this to the Tomcat Wiki as well.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to cluster two embedded tomcat 7 instances

Posted by Rüdiger Herrmann <rh...@eclipsesource.com>.
thanks for the hint. Here goes the link to the file:
  http://pastebin.com/6K4Ns4Tz

- Rüdiger

On Fri, Jun 10, 2011 at 22:35, Pid <pi...@pidster.com> wrote:
> On 10/06/2011 21:23, Rüdiger Herrmann wrote:
>> In case someone is interested, the code to programmatically set up a
>> clustered Tomcat instance is attached.p
>
> The list strips attachments unfortunately.  Try Pastebin/GitHub etc
>
>
> p
>
>



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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to cluster two embedded tomcat 7 instances

Posted by Pid <pi...@pidster.com>.
On 10/06/2011 21:23, Rüdiger Herrmann wrote:
> In case someone is interested, the code to programmatically set up a
> clustered Tomcat instance is attached.p

The list strips attachments unfortunately.  Try Pastebin/GitHub etc


p


Re: How to cluster two embedded tomcat 7 instances

Posted by Rüdiger Herrmann <rh...@eclipsesource.com>.
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
<rh...@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
> <ma...@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


Re: How to cluster two embedded tomcat 7 instances

Posted by Rüdiger Herrmann <rh...@eclipsesource.com>.
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
<ma...@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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to cluster two embedded tomcat 7 instances

Posted by Martin Grotzke <ma...@googlemail.com>.
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