You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Marco Betti <m....@gmail.com> on 2011/10/20 18:21:03 UTC

FarmWarDeployer undeploy on slave node when tomcat restart

Hi all,
I'm new to the list.
I'm trying to configure tomcat 6.0.33 clustering.
Session replication is ok.
I've a problem with FarmWarDeployer.
I found that:

1. You have to place the <Cluster> node under the <Host> element.

Tomcat 6.0.x complains that the element Cluster/Deployer element is not
understood at the Engine level.

2. One node needs to have watchEnabled="true", all other nodes
watchEnabled="false"

3. deployDir is the same as appBase


and after I found this post that confirmed these points to me:

http://www.mail-archive.com/users@tomcat.apache.org/msg80374.html

The problem is the following:
let node1 be the master (watchEnabled="true") and node2 the slave
(watchEnabled="false")
This is my configuration:
<Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"

tempDir="/appserv/tomcat/tomcat60/apache-tomcat-6.0.33/server/clu001node01/temp/"

deployDir="/appserv/tomcat/tomcat60/apache-tomcat-6.0.33/server/clu001node01/webapps/"

watchDir="/appserv/tomcat/tomcat60/apache-tomcat-6.0.33/server/clu001node01/farm/"
                    watchEnabled="true"/>


If I copy a war to watchDir of node1 evertything works fine and cluster
deploy is achieved.

When i restart node1, FarmWarDeployer undeploy my war both from node1 and
node2, but re-deploy it only on node1.

node1 log:

INFO: Cluster wide remove of web app /example
Oct 20, 2011 5:50:46 PM org.apache.catalina.startup.HostConfig
checkResources
INFO: Undeploying context [/example]
Oct 20, 2011 5:50:46 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive example.war


node2 log:

INFO: Undeploying context [/example]
Oct 20, 2011 5:50:47 PM org.apache.catalina.ha.deploy.FarmWarDeployer
messageReceived
SEVERE: Application /example in used. touch war file example.war again!


Obviously, if I touch my war in my watchDir on node1, tomcat redeploys it
correctly on both nodes... but this cannot be the solution...


Is it a known problem?

Could anyone help me?

Many thanks,
Marco

Re: FarmWarDeployer undeploy on slave node when tomcat restart

Posted by Mark Eggers <it...@yahoo.com>.
----- Original Message -----

> From: Marco Betti <m....@gmail.com>
> To: Tomcat Users List <us...@tomcat.apache.org>
> Cc: 
> Sent: Friday, October 21, 2011 7:18 AM
> Subject: Re: FarmWarDeployer undeploy on slave node when tomcat restart
> 
> Hi Keiichi,
> many thanks for your suggestion.
> By setting synchronous replication everything works.
> Unless processing updated war by one message, I think that async replication
> shouldn't be used (personal opinion).
> By the way I wander If asnyc replication couldn't lead to some other
> unexpected behavior.
> 
> Many thanks,
> Marco
> 
> 
> 
> 
> On Fri, Oct 21, 2011 at 12:10 PM, Keiichi Fujino <kf...@apache.org> 
> wrote:
> 
>>  I checked FarmWarDeployer's code.
>>  When WAR is updated, FarmWarDeployer sends UndeployMessage and sends
>>  FileMessage after that.
>>  The node which received UndeployMessage undeploys war.
>>  The node which received FileMessage deploys war.
>> 
>>  If FileMessage is received while processing UndeployMessage, the
>>  following error messages will be outputted.
>>  "SEVERE: Application /example in used. touch war file example.war 
> again!"
>> 
>>  In the case of asynchronous replication (default), FileMessage may be
>>  received while processing UndeployMessage.
>> 
>>  I think that it may be better to process updated war by one message.
>>  Although I consider correction of a code, there is one work around.
>> 
>>  Workaround is change in synchronous mode.
>> 
>>  Please try the following.
>>  <Cluster 
> className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
>>  channelSendOptions="6">
>> 
>> 
>>  2011/10/21 Marco Betti <m....@gmail.com>:
>>  > Tried also on Tomcat 7.0.22
>>  >
>>  > Same behaviour: when i restart node1, FarmWarDeployer undeploy my war
>>  both
>>  > from node1 and node2, but re-deploy it only on node1.
>>  > If I touch my war in my watchDir on node1, tomcat redeploys it 
> correctly
>>  on
>>  > both nodes...
>>  >
>>  > Is tomcat clustering used?
>>  >
>>  > If so, does anybody use FarmWarDeployer  ?
>>  >
>>  > Many thanks,
>>  > Marco
>>  >
>>  >
>>  >
>>  > On Thu, Oct 20, 2011 at 6:21 PM, Marco Betti <m....@gmail.com> 
> wrote:
>>  >
>>  >> Hi all,
>>  >> I'm new to the list.
>>  >> I'm trying to configure tomcat 6.0.33 clustering.
>>  >> Session replication is ok.
>>  >> I've a problem with FarmWarDeployer.
>>  >> I found that:
>>  >>
>>  >> 1. You have to place the <Cluster> node under the 
> <Host> element.
>>  >>
>>  >> Tomcat 6.0.x complains that the element Cluster/Deployer element 
> is not
>>  >> understood at the Engine level.
>>  >>
>>  >> 2. One node needs to have watchEnabled="true", all other 
> nodes
>>  >> watchEnabled="false"
>>  >>
>>  >> 3. deployDir is the same as appBase
>>  >>
>>  >>
>>  >> and after I found this post that confirmed these points to me:
>>  >>
>>  >> http://www.mail-archive.com/users@tomcat.apache.org/msg80374.html
>>  >>
>>  >> The problem is the following:
>>  >> let node1 be the master (watchEnabled="true") and node2 
> the slave
>>  >> (watchEnabled="false")
>>  >> This is my configuration:
>>  >> <Deployer 
> className="org.apache.catalina.ha.deploy.FarmWarDeployer"
>>  >>
>>  >>
>> 
> tempDir="/appserv/tomcat/tomcat60/apache-tomcat-6.0.33/server/clu001node01/temp/"
>>  >>
>>  >>
>> 
> deployDir="/appserv/tomcat/tomcat60/apache-tomcat-6.0.33/server/clu001node01/webapps/"
>>  >>
>>  >>
>> 
> watchDir="/appserv/tomcat/tomcat60/apache-tomcat-6.0.33/server/clu001node01/farm/"
>>  >>                     watchEnabled="true"/>
>>  >>
>>  >>
>>  >> If I copy a war to watchDir of node1 evertything works fine and 
> cluster
>>  >> deploy is achieved.
>>  >>
>>  >> When i restart node1, FarmWarDeployer undeploy my war both from 
> node1
>>  and
>>  >> node2, but re-deploy it only on node1.
>>  >>
>>  >> node1 log:
>>  >>
>>  >> INFO: Cluster wide remove of web app /example
>>  >> Oct 20, 2011 5:50:46 PM org.apache.catalina.startup.HostConfig
>>  >> checkResources
>>  >> INFO: Undeploying context [/example]
>>  >> Oct 20, 2011 5:50:46 PM org.apache.catalina.startup.HostConfig 
> deployWAR
>>  >> INFO: Deploying web application archive example.war
>>  >>
>>  >>
>>  >> node2 log:
>>  >>
>>  >> INFO: Undeploying context [/example]
>>  >> Oct 20, 2011 5:50:47 PM 
> org.apache.catalina.ha.deploy.FarmWarDeployer
>>  >> messageReceived
>>  >> SEVERE: Application /example in used. touch war file example.war 
> again!
>>  >>
>>  >>
>>  >> Obviously, if I touch my war in my watchDir on node1, tomcat 
> redeploys
>>  it
>>  >> correctly on both nodes... but this cannot be the solution...
>>  >>
>>  >>
>>  >> Is it a known problem?
>>  >>
>>  >> Could anyone help me?
>>  >>
>>  >> Many thanks,
>>  >> Marco
>>  >>



I've noticed this as well with FarmWarDeployer. However, I've always used synchronous as the channel option so it's not been a problem.

As to the placement of the cluster, yes you have to place it at the Host element in order for FarmWarDeployer to work. That note is buried in the documentation somewhere.

Another thing on my to-do list is to write up a basic clustering HOW-TO. Unfortunately right now I have no spare cycles.

One of the issues I have with FarmWarDeployer is that upon Tomcat restart the application is undeployed and redeployed cluster-wide. This can have several unintended consequences.

1. Makes the application unavailable cluster-wide (ouch)
2. Slows down restart
3. Could trigger permgen issues for troublesome applications

It would be nice if FarmWarDeployer checked file creation times between the deployDir and watchDir. Then if the deployDir times are later than the watchDir times, don't undeploy and redeploy the application.

I'm not sure how this would work with versioned web applications (just typing off the top of my head), but this might be a nice enhancement to the FarmWarDeployer.

I know . . . patches welcome. Unfortunately I have no spare cycles at present.

. . . . just my two cents.
/mde/

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


Re: FarmWarDeployer undeploy on slave node when tomcat restart

Posted by Marco Betti <m....@gmail.com>.
Hi Keiichi,
many thanks for your suggestion.
By setting synchronous replication everything works.
Unless processing updated war by one message, I think that async replication
shouldn't be used (personal opinion).
By the way I wander If asnyc replication couldn't lead to some other
unexpected behavior.

Many thanks,
Marco




On Fri, Oct 21, 2011 at 12:10 PM, Keiichi Fujino <kf...@apache.org> wrote:

> I checked FarmWarDeployer's code.
> When WAR is updated, FarmWarDeployer sends UndeployMessage and sends
> FileMessage after that.
> The node which received UndeployMessage undeploys war.
> The node which received FileMessage deploys war.
>
> If FileMessage is received while processing UndeployMessage, the
> following error messages will be outputted.
> "SEVERE: Application /example in used. touch war file example.war again!"
>
> In the case of asynchronous replication (default), FileMessage may be
> received while processing UndeployMessage.
>
> I think that it may be better to process updated war by one message.
> Although I consider correction of a code, there is one work around.
>
> Workaround is change in synchronous mode.
>
> Please try the following.
> <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
> channelSendOptions="6">
>
>
> 2011/10/21 Marco Betti <m....@gmail.com>:
> > Tried also on Tomcat 7.0.22
> >
> > Same behaviour: when i restart node1, FarmWarDeployer undeploy my war
> both
> > from node1 and node2, but re-deploy it only on node1.
> > If I touch my war in my watchDir on node1, tomcat redeploys it correctly
> on
> > both nodes...
> >
> > Is tomcat clustering used?
> >
> > If so, does anybody use FarmWarDeployer  ?
> >
> > Many thanks,
> > Marco
> >
> >
> >
> > On Thu, Oct 20, 2011 at 6:21 PM, Marco Betti <m....@gmail.com> wrote:
> >
> >> Hi all,
> >> I'm new to the list.
> >> I'm trying to configure tomcat 6.0.33 clustering.
> >> Session replication is ok.
> >> I've a problem with FarmWarDeployer.
> >> I found that:
> >>
> >> 1. You have to place the <Cluster> node under the <Host> element.
> >>
> >> Tomcat 6.0.x complains that the element Cluster/Deployer element is not
> >> understood at the Engine level.
> >>
> >> 2. One node needs to have watchEnabled="true", all other nodes
> >> watchEnabled="false"
> >>
> >> 3. deployDir is the same as appBase
> >>
> >>
> >> and after I found this post that confirmed these points to me:
> >>
> >> http://www.mail-archive.com/users@tomcat.apache.org/msg80374.html
> >>
> >> The problem is the following:
> >> let node1 be the master (watchEnabled="true") and node2 the slave
> >> (watchEnabled="false")
> >> This is my configuration:
> >> <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
> >>
> >>
> tempDir="/appserv/tomcat/tomcat60/apache-tomcat-6.0.33/server/clu001node01/temp/"
> >>
> >>
> deployDir="/appserv/tomcat/tomcat60/apache-tomcat-6.0.33/server/clu001node01/webapps/"
> >>
> >>
> watchDir="/appserv/tomcat/tomcat60/apache-tomcat-6.0.33/server/clu001node01/farm/"
> >>                     watchEnabled="true"/>
> >>
> >>
> >> If I copy a war to watchDir of node1 evertything works fine and cluster
> >> deploy is achieved.
> >>
> >> When i restart node1, FarmWarDeployer undeploy my war both from node1
> and
> >> node2, but re-deploy it only on node1.
> >>
> >> node1 log:
> >>
> >> INFO: Cluster wide remove of web app /example
> >> Oct 20, 2011 5:50:46 PM org.apache.catalina.startup.HostConfig
> >> checkResources
> >> INFO: Undeploying context [/example]
> >> Oct 20, 2011 5:50:46 PM org.apache.catalina.startup.HostConfig deployWAR
> >> INFO: Deploying web application archive example.war
> >>
> >>
> >> node2 log:
> >>
> >> INFO: Undeploying context [/example]
> >> Oct 20, 2011 5:50:47 PM org.apache.catalina.ha.deploy.FarmWarDeployer
> >> messageReceived
> >> SEVERE: Application /example in used. touch war file example.war again!
> >>
> >>
> >> Obviously, if I touch my war in my watchDir on node1, tomcat redeploys
> it
> >> correctly on both nodes... but this cannot be the solution...
> >>
> >>
> >> Is it a known problem?
> >>
> >> Could anyone help me?
> >>
> >> Many thanks,
> >> Marco
> >>
> >
>
>
>
> --
> Keiichi.Fujino
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Ing. Marco Betti
RHCE RHEL4 id 804006512121056

Re: FarmWarDeployer undeploy on slave node when tomcat restart

Posted by Keiichi Fujino <kf...@apache.org>.
I checked FarmWarDeployer's code.
When WAR is updated, FarmWarDeployer sends UndeployMessage and sends
FileMessage after that.
The node which received UndeployMessage undeploys war.
The node which received FileMessage deploys war.

If FileMessage is received while processing UndeployMessage, the
following error messages will be outputted.
"SEVERE: Application /example in used. touch war file example.war again!"

In the case of asynchronous replication (default), FileMessage may be
received while processing UndeployMessage.

I think that it may be better to process updated war by one message.
Although I consider correction of a code, there is one work around.

Workaround is change in synchronous mode.

Please try the following.
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
channelSendOptions="6">


2011/10/21 Marco Betti <m....@gmail.com>:
> Tried also on Tomcat 7.0.22
>
> Same behaviour: when i restart node1, FarmWarDeployer undeploy my war both
> from node1 and node2, but re-deploy it only on node1.
> If I touch my war in my watchDir on node1, tomcat redeploys it correctly on
> both nodes...
>
> Is tomcat clustering used?
>
> If so, does anybody use FarmWarDeployer  ?
>
> Many thanks,
> Marco
>
>
>
> On Thu, Oct 20, 2011 at 6:21 PM, Marco Betti <m....@gmail.com> wrote:
>
>> Hi all,
>> I'm new to the list.
>> I'm trying to configure tomcat 6.0.33 clustering.
>> Session replication is ok.
>> I've a problem with FarmWarDeployer.
>> I found that:
>>
>> 1. You have to place the <Cluster> node under the <Host> element.
>>
>> Tomcat 6.0.x complains that the element Cluster/Deployer element is not
>> understood at the Engine level.
>>
>> 2. One node needs to have watchEnabled="true", all other nodes
>> watchEnabled="false"
>>
>> 3. deployDir is the same as appBase
>>
>>
>> and after I found this post that confirmed these points to me:
>>
>> http://www.mail-archive.com/users@tomcat.apache.org/msg80374.html
>>
>> The problem is the following:
>> let node1 be the master (watchEnabled="true") and node2 the slave
>> (watchEnabled="false")
>> This is my configuration:
>> <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
>>
>> tempDir="/appserv/tomcat/tomcat60/apache-tomcat-6.0.33/server/clu001node01/temp/"
>>
>> deployDir="/appserv/tomcat/tomcat60/apache-tomcat-6.0.33/server/clu001node01/webapps/"
>>
>> watchDir="/appserv/tomcat/tomcat60/apache-tomcat-6.0.33/server/clu001node01/farm/"
>>                     watchEnabled="true"/>
>>
>>
>> If I copy a war to watchDir of node1 evertything works fine and cluster
>> deploy is achieved.
>>
>> When i restart node1, FarmWarDeployer undeploy my war both from node1 and
>> node2, but re-deploy it only on node1.
>>
>> node1 log:
>>
>> INFO: Cluster wide remove of web app /example
>> Oct 20, 2011 5:50:46 PM org.apache.catalina.startup.HostConfig
>> checkResources
>> INFO: Undeploying context [/example]
>> Oct 20, 2011 5:50:46 PM org.apache.catalina.startup.HostConfig deployWAR
>> INFO: Deploying web application archive example.war
>>
>>
>> node2 log:
>>
>> INFO: Undeploying context [/example]
>> Oct 20, 2011 5:50:47 PM org.apache.catalina.ha.deploy.FarmWarDeployer
>> messageReceived
>> SEVERE: Application /example in used. touch war file example.war again!
>>
>>
>> Obviously, if I touch my war in my watchDir on node1, tomcat redeploys it
>> correctly on both nodes... but this cannot be the solution...
>>
>>
>> Is it a known problem?
>>
>> Could anyone help me?
>>
>> Many thanks,
>> Marco
>>
>



-- 
Keiichi.Fujino

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


Re: FarmWarDeployer undeploy on slave node when tomcat restart

Posted by Marco Betti <m....@gmail.com>.
Tried also on Tomcat 7.0.22

Same behaviour: when i restart node1, FarmWarDeployer undeploy my war both
from node1 and node2, but re-deploy it only on node1.
If I touch my war in my watchDir on node1, tomcat redeploys it correctly on
both nodes...

Is tomcat clustering used?

If so, does anybody use FarmWarDeployer  ?

Many thanks,
Marco



On Thu, Oct 20, 2011 at 6:21 PM, Marco Betti <m....@gmail.com> wrote:

> Hi all,
> I'm new to the list.
> I'm trying to configure tomcat 6.0.33 clustering.
> Session replication is ok.
> I've a problem with FarmWarDeployer.
> I found that:
>
> 1. You have to place the <Cluster> node under the <Host> element.
>
> Tomcat 6.0.x complains that the element Cluster/Deployer element is not
> understood at the Engine level.
>
> 2. One node needs to have watchEnabled="true", all other nodes
> watchEnabled="false"
>
> 3. deployDir is the same as appBase
>
>
> and after I found this post that confirmed these points to me:
>
> http://www.mail-archive.com/users@tomcat.apache.org/msg80374.html
>
> The problem is the following:
> let node1 be the master (watchEnabled="true") and node2 the slave
> (watchEnabled="false")
> This is my configuration:
> <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
>
> tempDir="/appserv/tomcat/tomcat60/apache-tomcat-6.0.33/server/clu001node01/temp/"
>
> deployDir="/appserv/tomcat/tomcat60/apache-tomcat-6.0.33/server/clu001node01/webapps/"
>
> watchDir="/appserv/tomcat/tomcat60/apache-tomcat-6.0.33/server/clu001node01/farm/"
>                     watchEnabled="true"/>
>
>
> If I copy a war to watchDir of node1 evertything works fine and cluster
> deploy is achieved.
>
> When i restart node1, FarmWarDeployer undeploy my war both from node1 and
> node2, but re-deploy it only on node1.
>
> node1 log:
>
> INFO: Cluster wide remove of web app /example
> Oct 20, 2011 5:50:46 PM org.apache.catalina.startup.HostConfig
> checkResources
> INFO: Undeploying context [/example]
> Oct 20, 2011 5:50:46 PM org.apache.catalina.startup.HostConfig deployWAR
> INFO: Deploying web application archive example.war
>
>
> node2 log:
>
> INFO: Undeploying context [/example]
> Oct 20, 2011 5:50:47 PM org.apache.catalina.ha.deploy.FarmWarDeployer
> messageReceived
> SEVERE: Application /example in used. touch war file example.war again!
>
>
> Obviously, if I touch my war in my watchDir on node1, tomcat redeploys it
> correctly on both nodes... but this cannot be the solution...
>
>
> Is it a known problem?
>
> Could anyone help me?
>
> Many thanks,
> Marco
>