You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Josef Pullicino <jo...@go.com.mt> on 2010/03/12 10:29:33 UTC

How to setup Tomcat Cluster - Help needed

Dear All,

I would like to setup a tomcat cluster with 2 nodes. The configuration
must be in a horizontal alignment, meaning that the two nodes are going
to reside on two different machines. Any idea of how to set it up since
the default tomcat help guide does not provide any configuration
examples.

Any help would be greatly appreciated.

Thanks for your support,

Regards,

Josef Pullicino

Systems Administrator

GO

 

GO Mobile, Fra Diego Street, Marsa, MRS 1501, Malta.

t  +356 2594 6827     f  +356 2124 0112

w www.go.com.mt

 

This email and any files or content transmitted with it are confidential
and intended solely for the use of the individual or entity to whom they
are addressed. This message contains confidential information and is
intended only for the individual named. If you are not the named
addressee you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system. If you are
not the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
information is strictly prohibited. The Company and the originator of
this email accept no liability for the content of this email, or for the
consequences of any actions taken on the basis of the information
provided, unless that information is subsequently confirmed in writing.
If you are not the intended recipient you are notified that disclosing,
copying, distributing or taking any action in reliance on the contents
of this information is strictly prohibited.


Warning: Although the Company and the originator  have taken reasonable
precautions to ensure no viruses are present in this email, the company
cannot accept responsibility for any loss or damage arising from the use
of this email or attachments.

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


Re: How to setup Tomcat Cluster - Help needed

Posted by Philip Wigg <ph...@philipwigg.co.uk>.
On 12 March 2010 09:29, Josef Pullicino <jo...@go.com.mt> wrote:
> Dear All,
>
> I would like to setup a tomcat cluster with 2 nodes. The configuration
> must be in a horizontal alignment, meaning that the two nodes are going
> to reside on two different machines. Any idea of how to set it up since
> the default tomcat help guide does not provide any configuration
> examples.

http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html

-- Phil

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


RE: How to setup Tomcat Cluster - Help needed

Posted by Josef Pullicino <jo...@go.com.mt>.
Robin,

Thanks a lot for your kind help. In fact, those were the ways that we
were thinking to setup. 

Thanks again for your cooperation :)

Kind Regards,

Josef Pullicino

Systems Administrator

GO

 

GO Mobile, Fra Diego Street, Marsa, MRS 1501, Malta.

t  +356 2594 6827     f  +356 2124 0112

w www.go.com.mt

 

This email and any files or content transmitted with it are confidential
and intended solely for the use of the individual or entity to whom they
are addressed. This message contains confidential information and is
intended only for the individual named. If you are not the named
addressee you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system. If you are
not the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
information is strictly prohibited. The Company and the originator of
this email accept no liability for the content of this email, or for the
consequences of any actions taken on the basis of the information
provided, unless that information is subsequently confirmed in writing.
If you are not the intended recipient you are notified that disclosing,
copying, distributing or taking any action in reliance on the contents
of this information is strictly prohibited.


Warning: Although the Company and the originator  have taken reasonable
precautions to ensure no viruses are present in this email, the company
cannot accept responsibility for any loss or damage arising from the use
of this email or attachments.


-----Original Message-----
From: Robin D. Wilson [mailto:rwilson2@gmail.com] 
Sent: 12 March 2010 15:21
To: 'Tomcat Users List'
Subject: RE: How to setup Tomcat Cluster - Help needed

I can't recall exactly why we went with the channelSendOptions="6", but
the docs are here:

http://tomcat.apache.org/tomcat-6.0-doc/config/cluster.html

Basically the '6' was to use synchronous replication.

To get the receiver to stop 'auto' configuring on the loopback interface
(lo0), we just hard-coded the IP address for each host's
'et0' interface in the receiver:

<Receiver
className="org.apache.catalina.tribes.transport.nio.NioReceiver"
	address="111.111.111.111"
	port="5000"
	selectorTimeout="100"
	maxThreads="6"/>

(So you would change the '111.111.111.111' above to match the IP address
of the host you are configuring.)

The only downside to this is that you have to have a different
'server.xml' file for each host in the cluster.

Once you get this up, and you have your '<distributable />' tag in your
'web.xml' you should be replicating sessions between the two
hosts.

We use an 'apache' setup to proxy (over AJP) to our tomcats, so in our
testing we setup a load-balancing config from apache, and our
simple test is to only enable 'tomcat 1' from apache, login - which
should set the session on 'tomcat 1'. Then reset the apache so
that 'tomcat 2' is the proxied host - and see if we're still logged
in... That seemed to work for us.


--
Robin D. Wilson
Director of Web Development
KingsIsle Entertainment, Inc.
CELL: 512-426-3929
DESK: 512-623-5913
www.KingsIsle.com


-----Original Message-----
From: Josef Pullicino [mailto:josef.pullicino@go.com.mt] 
Sent: Friday, March 12, 2010 8:04 AM
To: Tomcat Users List
Subject: RE: How to setup Tomcat Cluster - Help needed

Dear Robin,

Thanks very much for your kind help and information provided below. 

Up till now, I copied the following configuration into the server.xml
file of each of the two tomcats. The result is that each tomcat is being
aware of each member added or deleted to/from each tomcat. So, I guess
that the tomcats are communicating well in between them.

<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm2">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->        
        <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
                 channelSendOptions="6">

          <Manager
className="org.apache.catalina.ha.session.BackupManager"
                   expireSessionsOnShutdown="false"
                   notifyListenersOnReplication="true"
                   mapSendOptions="6"/>
          <!--
          <Manager
className="org.apache.catalina.ha.session.DeltaManager"
                   expireSessionsOnShutdown="false"
                   notifyListenersOnReplication="true"/>
          -->        
          <Channel
className="org.apache.catalina.tribes.group.GroupChannel">
            <Membership
className="org.apache.catalina.tribes.membership.McastService"
                        address="228.0.0.4"
                        port="45564"
                        frequency="500"
                        dropTime="3000"/>
            <Receiver
className="org.apache.catalina.tribes.transport.nio.NioReceiver"
                      address="auto"
                      port="5000"
                      selectorTimeout="100"
                      maxThreads="6"/>

            <Sender
className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
              <Transport
className="org.apache.catalina.tribes.transport.nio.PooledParallelSender
"/>
            </Sender>
            <Interceptor
className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetec
tor"/>
            <Interceptor
className="org.apache.catalina.tribes.group.interceptors.MessageDispatch
15Interceptor"/>
            <Interceptor
className="org.apache.catalina.tribes.group.interceptors.ThroughputInter
ceptor"/>
          </Channel>

          <Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
 
filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;
"/>

          <Deployer
className="org.apache.catalina.ha.deploy.FarmWarDeployer"
                    tempDir="/tmp/war-temp/"
                    deployDir="/tmp/war-deploy/"
                    watchDir="/tmp/war-listen/"
                    watchEnabled="false"/>

          <ClusterListener
className="org.apache.catalina.ha.session.ClusterSessionListener"/>
        </Cluster>

With regards to your suggestions, what is the difference between
"channelSendOptions" setting to '6' instead of '8'? Also, how did you
setup the configuration so that it will not pick up the loopback
(127.0.0.1) but using the eth0?

Thanks a lot for your kind help provide. Really appreciated.

Regards, 

Josef Pullicino

Systems Administrator

GO
GO Mobile, Fra Diego Street, Marsa, MRS 1501, Malta.

t  +356 2594 6827     f  +356 2124 0112

w www.go.com.mt

 

This email and any files or content transmitted with it are confidential
and intended solely for the use of the individual or entity to whom they
are addressed. This message contains confidential information and is
intended only for the individual named. If you are not the named
addressee you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system. If you are
not the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
information is strictly prohibited. The Company and the originator of
this email accept no liability for the content of this email, or for the
consequences of any actions taken on the basis of the information
provided, unless that information is subsequently confirmed in writing.
If you are not the intended recipient you are notified that disclosing,
copying, distributing or taking any action in reliance on the contents
of this information is strictly prohibited.


Warning: Although the Company and the originator  have taken reasonable
precautions to ensure no viruses are present in this email, the company
cannot accept responsibility for any loss or damage arising from the use
of this email or attachments.

-----Original Message-----
From: Robin D. Wilson [mailto:rwilson2@gmail.com] 
Sent: 12 March 2010 14:12
To: 'Tomcat Users List'
Subject: RE: How to setup Tomcat Cluster - Help needed

This reference is what we used - it seemed to work fine for us:

	http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html

Don't forget to add this part:

	<distributable/> 

Into the 'web.xml' file from the ".war" files you want to use clustered
sessions.

In our environment, we have 4 ".war" files with various webapps we
deploy. Only our 'ROOT.war' is "clustered" though. So it is the
only ".war" file with the distributable tag in its web.xml.

Also, we changed a few settings in the 'server.xml' file settings, such
as: 

	1) Changed the "channelSendOptions" setting to '6' instead of
'8'...

	2) Increased some of the timeouts (we have a high-volume
environment, and 4 clustered tomcats)

	3) Removed the 'autobind' and manually set the IP addresses of
the Receiver (it was picking the
		wrong interface - lo0 (127.0.0.1) instead of 'et0'...)

Lastly, you need to change (at least) the port # for the "McastService"
if you are running multiple clusters on the same network.
(For example, all of our developers have their own "personal" clusters -
so each of them uses a different 'port' for their cluster's
multicast messages - this avoids cross-talk between their cluster and
our main environment. Of course, our production environment is
completely isolated from this - but when you are testing multiple
environments, this can be confusing...)

PS. We made adjustments to the DeltaManager and SessionManager code for
some unique session issues we had - because we are using
Tapestry, and it creates a session if there are any 'form' tags on a
page. This meant that our site was creating a session for every
visitor - which sort of overwhelmed the cluster (all sessions are
supposed to be replicated to all cluster members - right?)... So
our adjustments just keep certain sessions from wasting cluster
bandwidth if they are of sufficiently short duration so as not to
warrant replication. The best way to avoid this is to not create
sessions that you don't really want replicated to all members of
the cluster.

--
Robin D. Wilson
Director of Web Development
KingsIsle Entertainment, Inc.
CELL: 512-426-3929
DESK: 512-623-5913
www.KingsIsle.com


-----Original Message-----
From: Josef Pullicino [mailto:josef.pullicino@go.com.mt] 
Sent: Friday, March 12, 2010 3:30 AM
To: Tomcat Users List
Subject: How to setup Tomcat Cluster - Help needed

Dear All,

I would like to setup a tomcat cluster with 2 nodes. The configuration
must be in a horizontal alignment, meaning that the two nodes are going
to reside on two different machines. Any idea of how to set it up since
the default tomcat help guide does not provide any configuration
examples.

Any help would be greatly appreciated.

Thanks for your support,

Regards,

Josef Pullicino

Systems Administrator

GO

 

GO Mobile, Fra Diego Street, Marsa, MRS 1501, Malta.

t  +356 2594 6827     f  +356 2124 0112

w www.go.com.mt

 

This email and any files or content transmitted with it are confidential
and intended solely for the use of the individual or entity to whom they
are addressed. This message contains confidential information and is
intended only for the individual named. If you are not the named
addressee you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system. If you are
not the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
information is strictly prohibited. The Company and the originator of
this email accept no liability for the content of this email, or for the
consequences of any actions taken on the basis of the information
provided, unless that information is subsequently confirmed in writing.
If you are not the intended recipient you are notified that disclosing,
copying, distributing or taking any action in reliance on the contents
of this information is strictly prohibited.


Warning: Although the Company and the originator  have taken reasonable
precautions to ensure no viruses are present in this email, the company
cannot accept responsibility for any loss or damage arising from the use
of this email or attachments.

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


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


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


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


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


RE: How to setup Tomcat Cluster - Help needed

Posted by "Robin D. Wilson" <rw...@gmail.com>.
I can't recall exactly why we went with the channelSendOptions="6", but the docs are here:

http://tomcat.apache.org/tomcat-6.0-doc/config/cluster.html

Basically the '6' was to use synchronous replication.

To get the receiver to stop 'auto' configuring on the loopback interface (lo0), we just hard-coded the IP address for each host's
'et0' interface in the receiver:

<Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
	address="111.111.111.111"
	port="5000"
	selectorTimeout="100"
	maxThreads="6"/>

(So you would change the '111.111.111.111' above to match the IP address of the host you are configuring.)

The only downside to this is that you have to have a different 'server.xml' file for each host in the cluster.

Once you get this up, and you have your '<distributable />' tag in your 'web.xml' you should be replicating sessions between the two
hosts.

We use an 'apache' setup to proxy (over AJP) to our tomcats, so in our testing we setup a load-balancing config from apache, and our
simple test is to only enable 'tomcat 1' from apache, login - which should set the session on 'tomcat 1'. Then reset the apache so
that 'tomcat 2' is the proxied host - and see if we're still logged in... That seemed to work for us.


--
Robin D. Wilson
Director of Web Development
KingsIsle Entertainment, Inc.
CELL: 512-426-3929
DESK: 512-623-5913
www.KingsIsle.com


-----Original Message-----
From: Josef Pullicino [mailto:josef.pullicino@go.com.mt] 
Sent: Friday, March 12, 2010 8:04 AM
To: Tomcat Users List
Subject: RE: How to setup Tomcat Cluster - Help needed

Dear Robin,

Thanks very much for your kind help and information provided below. 

Up till now, I copied the following configuration into the server.xml
file of each of the two tomcats. The result is that each tomcat is being
aware of each member added or deleted to/from each tomcat. So, I guess
that the tomcats are communicating well in between them.

<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm2">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->        
        <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
                 channelSendOptions="6">

          <Manager
className="org.apache.catalina.ha.session.BackupManager"
                   expireSessionsOnShutdown="false"
                   notifyListenersOnReplication="true"
                   mapSendOptions="6"/>
          <!--
          <Manager
className="org.apache.catalina.ha.session.DeltaManager"
                   expireSessionsOnShutdown="false"
                   notifyListenersOnReplication="true"/>
          -->        
          <Channel
className="org.apache.catalina.tribes.group.GroupChannel">
            <Membership
className="org.apache.catalina.tribes.membership.McastService"
                        address="228.0.0.4"
                        port="45564"
                        frequency="500"
                        dropTime="3000"/>
            <Receiver
className="org.apache.catalina.tribes.transport.nio.NioReceiver"
                      address="auto"
                      port="5000"
                      selectorTimeout="100"
                      maxThreads="6"/>

            <Sender
className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
              <Transport
className="org.apache.catalina.tribes.transport.nio.PooledParallelSender
"/>
            </Sender>
            <Interceptor
className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetec
tor"/>
            <Interceptor
className="org.apache.catalina.tribes.group.interceptors.MessageDispatch
15Interceptor"/>
            <Interceptor
className="org.apache.catalina.tribes.group.interceptors.ThroughputInter
ceptor"/>
          </Channel>

          <Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
 
filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;
"/>

          <Deployer
className="org.apache.catalina.ha.deploy.FarmWarDeployer"
                    tempDir="/tmp/war-temp/"
                    deployDir="/tmp/war-deploy/"
                    watchDir="/tmp/war-listen/"
                    watchEnabled="false"/>

          <ClusterListener
className="org.apache.catalina.ha.session.ClusterSessionListener"/>
        </Cluster>

With regards to your suggestions, what is the difference between
"channelSendOptions" setting to '6' instead of '8'? Also, how did you
setup the configuration so that it will not pick up the loopback
(127.0.0.1) but using the eth0?

Thanks a lot for your kind help provide. Really appreciated.

Regards, 

Josef Pullicino

Systems Administrator

GO
GO Mobile, Fra Diego Street, Marsa, MRS 1501, Malta.

t  +356 2594 6827     f  +356 2124 0112

w www.go.com.mt

 

This email and any files or content transmitted with it are confidential
and intended solely for the use of the individual or entity to whom they
are addressed. This message contains confidential information and is
intended only for the individual named. If you are not the named
addressee you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system. If you are
not the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
information is strictly prohibited. The Company and the originator of
this email accept no liability for the content of this email, or for the
consequences of any actions taken on the basis of the information
provided, unless that information is subsequently confirmed in writing.
If you are not the intended recipient you are notified that disclosing,
copying, distributing or taking any action in reliance on the contents
of this information is strictly prohibited.


Warning: Although the Company and the originator  have taken reasonable
precautions to ensure no viruses are present in this email, the company
cannot accept responsibility for any loss or damage arising from the use
of this email or attachments.

-----Original Message-----
From: Robin D. Wilson [mailto:rwilson2@gmail.com] 
Sent: 12 March 2010 14:12
To: 'Tomcat Users List'
Subject: RE: How to setup Tomcat Cluster - Help needed

This reference is what we used - it seemed to work fine for us:

	http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html

Don't forget to add this part:

	<distributable/> 

Into the 'web.xml' file from the ".war" files you want to use clustered
sessions.

In our environment, we have 4 ".war" files with various webapps we
deploy. Only our 'ROOT.war' is "clustered" though. So it is the
only ".war" file with the distributable tag in its web.xml.

Also, we changed a few settings in the 'server.xml' file settings, such
as: 

	1) Changed the "channelSendOptions" setting to '6' instead of
'8'...

	2) Increased some of the timeouts (we have a high-volume
environment, and 4 clustered tomcats)

	3) Removed the 'autobind' and manually set the IP addresses of
the Receiver (it was picking the
		wrong interface - lo0 (127.0.0.1) instead of 'et0'...)

Lastly, you need to change (at least) the port # for the "McastService"
if you are running multiple clusters on the same network.
(For example, all of our developers have their own "personal" clusters -
so each of them uses a different 'port' for their cluster's
multicast messages - this avoids cross-talk between their cluster and
our main environment. Of course, our production environment is
completely isolated from this - but when you are testing multiple
environments, this can be confusing...)

PS. We made adjustments to the DeltaManager and SessionManager code for
some unique session issues we had - because we are using
Tapestry, and it creates a session if there are any 'form' tags on a
page. This meant that our site was creating a session for every
visitor - which sort of overwhelmed the cluster (all sessions are
supposed to be replicated to all cluster members - right?)... So
our adjustments just keep certain sessions from wasting cluster
bandwidth if they are of sufficiently short duration so as not to
warrant replication. The best way to avoid this is to not create
sessions that you don't really want replicated to all members of
the cluster.

--
Robin D. Wilson
Director of Web Development
KingsIsle Entertainment, Inc.
CELL: 512-426-3929
DESK: 512-623-5913
www.KingsIsle.com


-----Original Message-----
From: Josef Pullicino [mailto:josef.pullicino@go.com.mt] 
Sent: Friday, March 12, 2010 3:30 AM
To: Tomcat Users List
Subject: How to setup Tomcat Cluster - Help needed

Dear All,

I would like to setup a tomcat cluster with 2 nodes. The configuration
must be in a horizontal alignment, meaning that the two nodes are going
to reside on two different machines. Any idea of how to set it up since
the default tomcat help guide does not provide any configuration
examples.

Any help would be greatly appreciated.

Thanks for your support,

Regards,

Josef Pullicino

Systems Administrator

GO

 

GO Mobile, Fra Diego Street, Marsa, MRS 1501, Malta.

t  +356 2594 6827     f  +356 2124 0112

w www.go.com.mt

 

This email and any files or content transmitted with it are confidential
and intended solely for the use of the individual or entity to whom they
are addressed. This message contains confidential information and is
intended only for the individual named. If you are not the named
addressee you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system. If you are
not the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
information is strictly prohibited. The Company and the originator of
this email accept no liability for the content of this email, or for the
consequences of any actions taken on the basis of the information
provided, unless that information is subsequently confirmed in writing.
If you are not the intended recipient you are notified that disclosing,
copying, distributing or taking any action in reliance on the contents
of this information is strictly prohibited.


Warning: Although the Company and the originator  have taken reasonable
precautions to ensure no viruses are present in this email, the company
cannot accept responsibility for any loss or damage arising from the use
of this email or attachments.

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


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


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


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


RE: How to setup Tomcat Cluster - Help needed

Posted by Josef Pullicino <jo...@go.com.mt>.
Dear Robin,

Thanks very much for your kind help and information provided below. 

Up till now, I copied the following configuration into the server.xml
file of each of the two tomcats. The result is that each tomcat is being
aware of each member added or deleted to/from each tomcat. So, I guess
that the tomcats are communicating well in between them.

<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm2">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->        
        <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
                 channelSendOptions="6">

          <Manager
className="org.apache.catalina.ha.session.BackupManager"
                   expireSessionsOnShutdown="false"
                   notifyListenersOnReplication="true"
                   mapSendOptions="6"/>
          <!--
          <Manager
className="org.apache.catalina.ha.session.DeltaManager"
                   expireSessionsOnShutdown="false"
                   notifyListenersOnReplication="true"/>
          -->        
          <Channel
className="org.apache.catalina.tribes.group.GroupChannel">
            <Membership
className="org.apache.catalina.tribes.membership.McastService"
                        address="228.0.0.4"
                        port="45564"
                        frequency="500"
                        dropTime="3000"/>
            <Receiver
className="org.apache.catalina.tribes.transport.nio.NioReceiver"
                      address="auto"
                      port="5000"
                      selectorTimeout="100"
                      maxThreads="6"/>

            <Sender
className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
              <Transport
className="org.apache.catalina.tribes.transport.nio.PooledParallelSender
"/>
            </Sender>
            <Interceptor
className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetec
tor"/>
            <Interceptor
className="org.apache.catalina.tribes.group.interceptors.MessageDispatch
15Interceptor"/>
            <Interceptor
className="org.apache.catalina.tribes.group.interceptors.ThroughputInter
ceptor"/>
          </Channel>

          <Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
 
filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;
"/>

          <Deployer
className="org.apache.catalina.ha.deploy.FarmWarDeployer"
                    tempDir="/tmp/war-temp/"
                    deployDir="/tmp/war-deploy/"
                    watchDir="/tmp/war-listen/"
                    watchEnabled="false"/>

          <ClusterListener
className="org.apache.catalina.ha.session.ClusterSessionListener"/>
        </Cluster>

With regards to your suggestions, what is the difference between
"channelSendOptions" setting to '6' instead of '8'? Also, how did you
setup the configuration so that it will not pick up the loopback
(127.0.0.1) but using the eth0?

Thanks a lot for your kind help provide. Really appreciated.

Regards, 

Josef Pullicino

Systems Administrator

GO
GO Mobile, Fra Diego Street, Marsa, MRS 1501, Malta.

t  +356 2594 6827     f  +356 2124 0112

w www.go.com.mt

 

This email and any files or content transmitted with it are confidential
and intended solely for the use of the individual or entity to whom they
are addressed. This message contains confidential information and is
intended only for the individual named. If you are not the named
addressee you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system. If you are
not the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
information is strictly prohibited. The Company and the originator of
this email accept no liability for the content of this email, or for the
consequences of any actions taken on the basis of the information
provided, unless that information is subsequently confirmed in writing.
If you are not the intended recipient you are notified that disclosing,
copying, distributing or taking any action in reliance on the contents
of this information is strictly prohibited.


Warning: Although the Company and the originator  have taken reasonable
precautions to ensure no viruses are present in this email, the company
cannot accept responsibility for any loss or damage arising from the use
of this email or attachments.

-----Original Message-----
From: Robin D. Wilson [mailto:rwilson2@gmail.com] 
Sent: 12 March 2010 14:12
To: 'Tomcat Users List'
Subject: RE: How to setup Tomcat Cluster - Help needed

This reference is what we used - it seemed to work fine for us:

	http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html

Don't forget to add this part:

	<distributable/> 

Into the 'web.xml' file from the ".war" files you want to use clustered
sessions.

In our environment, we have 4 ".war" files with various webapps we
deploy. Only our 'ROOT.war' is "clustered" though. So it is the
only ".war" file with the distributable tag in its web.xml.

Also, we changed a few settings in the 'server.xml' file settings, such
as: 

	1) Changed the "channelSendOptions" setting to '6' instead of
'8'...

	2) Increased some of the timeouts (we have a high-volume
environment, and 4 clustered tomcats)

	3) Removed the 'autobind' and manually set the IP addresses of
the Receiver (it was picking the
		wrong interface - lo0 (127.0.0.1) instead of 'et0'...)

Lastly, you need to change (at least) the port # for the "McastService"
if you are running multiple clusters on the same network.
(For example, all of our developers have their own "personal" clusters -
so each of them uses a different 'port' for their cluster's
multicast messages - this avoids cross-talk between their cluster and
our main environment. Of course, our production environment is
completely isolated from this - but when you are testing multiple
environments, this can be confusing...)

PS. We made adjustments to the DeltaManager and SessionManager code for
some unique session issues we had - because we are using
Tapestry, and it creates a session if there are any 'form' tags on a
page. This meant that our site was creating a session for every
visitor - which sort of overwhelmed the cluster (all sessions are
supposed to be replicated to all cluster members - right?)... So
our adjustments just keep certain sessions from wasting cluster
bandwidth if they are of sufficiently short duration so as not to
warrant replication. The best way to avoid this is to not create
sessions that you don't really want replicated to all members of
the cluster.

--
Robin D. Wilson
Director of Web Development
KingsIsle Entertainment, Inc.
CELL: 512-426-3929
DESK: 512-623-5913
www.KingsIsle.com


-----Original Message-----
From: Josef Pullicino [mailto:josef.pullicino@go.com.mt] 
Sent: Friday, March 12, 2010 3:30 AM
To: Tomcat Users List
Subject: How to setup Tomcat Cluster - Help needed

Dear All,

I would like to setup a tomcat cluster with 2 nodes. The configuration
must be in a horizontal alignment, meaning that the two nodes are going
to reside on two different machines. Any idea of how to set it up since
the default tomcat help guide does not provide any configuration
examples.

Any help would be greatly appreciated.

Thanks for your support,

Regards,

Josef Pullicino

Systems Administrator

GO

 

GO Mobile, Fra Diego Street, Marsa, MRS 1501, Malta.

t  +356 2594 6827     f  +356 2124 0112

w www.go.com.mt

 

This email and any files or content transmitted with it are confidential
and intended solely for the use of the individual or entity to whom they
are addressed. This message contains confidential information and is
intended only for the individual named. If you are not the named
addressee you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system. If you are
not the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
information is strictly prohibited. The Company and the originator of
this email accept no liability for the content of this email, or for the
consequences of any actions taken on the basis of the information
provided, unless that information is subsequently confirmed in writing.
If you are not the intended recipient you are notified that disclosing,
copying, distributing or taking any action in reliance on the contents
of this information is strictly prohibited.


Warning: Although the Company and the originator  have taken reasonable
precautions to ensure no viruses are present in this email, the company
cannot accept responsibility for any loss or damage arising from the use
of this email or attachments.

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


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


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


RE: How to setup Tomcat Cluster - Help needed

Posted by "Robin D. Wilson" <rw...@gmail.com>.
This reference is what we used - it seemed to work fine for us:

	http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html

Don't forget to add this part:

	<distributable/> 

Into the 'web.xml' file from the ".war" files you want to use clustered sessions.

In our environment, we have 4 ".war" files with various webapps we deploy. Only our 'ROOT.war' is "clustered" though. So it is the
only ".war" file with the distributable tag in its web.xml.

Also, we changed a few settings in the 'server.xml' file settings, such as: 

	1) Changed the "channelSendOptions" setting to '6' instead of '8'...

	2) Increased some of the timeouts (we have a high-volume environment, and 4 clustered tomcats)

	3) Removed the 'autobind' and manually set the IP addresses of the Receiver (it was picking the
		wrong interface - lo0 (127.0.0.1) instead of 'et0'...)

Lastly, you need to change (at least) the port # for the "McastService" if you are running multiple clusters on the same network.
(For example, all of our developers have their own "personal" clusters - so each of them uses a different 'port' for their cluster's
multicast messages - this avoids cross-talk between their cluster and our main environment. Of course, our production environment is
completely isolated from this - but when you are testing multiple environments, this can be confusing...)

PS. We made adjustments to the DeltaManager and SessionManager code for some unique session issues we had - because we are using
Tapestry, and it creates a session if there are any 'form' tags on a page. This meant that our site was creating a session for every
visitor - which sort of overwhelmed the cluster (all sessions are supposed to be replicated to all cluster members - right?)... So
our adjustments just keep certain sessions from wasting cluster bandwidth if they are of sufficiently short duration so as not to
warrant replication. The best way to avoid this is to not create sessions that you don't really want replicated to all members of
the cluster.

--
Robin D. Wilson
Director of Web Development
KingsIsle Entertainment, Inc.
CELL: 512-426-3929
DESK: 512-623-5913
www.KingsIsle.com


-----Original Message-----
From: Josef Pullicino [mailto:josef.pullicino@go.com.mt] 
Sent: Friday, March 12, 2010 3:30 AM
To: Tomcat Users List
Subject: How to setup Tomcat Cluster - Help needed

Dear All,

I would like to setup a tomcat cluster with 2 nodes. The configuration
must be in a horizontal alignment, meaning that the two nodes are going
to reside on two different machines. Any idea of how to set it up since
the default tomcat help guide does not provide any configuration
examples.

Any help would be greatly appreciated.

Thanks for your support,

Regards,

Josef Pullicino

Systems Administrator

GO

 

GO Mobile, Fra Diego Street, Marsa, MRS 1501, Malta.

t  +356 2594 6827     f  +356 2124 0112

w www.go.com.mt

 

This email and any files or content transmitted with it are confidential
and intended solely for the use of the individual or entity to whom they
are addressed. This message contains confidential information and is
intended only for the individual named. If you are not the named
addressee you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system. If you are
not the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
information is strictly prohibited. The Company and the originator of
this email accept no liability for the content of this email, or for the
consequences of any actions taken on the basis of the information
provided, unless that information is subsequently confirmed in writing.
If you are not the intended recipient you are notified that disclosing,
copying, distributing or taking any action in reliance on the contents
of this information is strictly prohibited.


Warning: Although the Company and the originator  have taken reasonable
precautions to ensure no viruses are present in this email, the company
cannot accept responsibility for any loss or damage arising from the use
of this email or attachments.

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


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