You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "shammi@arosys.com" <sh...@arosys.com> on 2010/08/06 11:28:22 UTC

Is FarmWarDeployer is working?

Hi, This is my first mail and If is not the correct palce then do inform me.
I am using Tomcat7.0.0 and working on Linux/Debian machine.
I am configuring the Tomcat for the Session object persistance.
I have created two instances of tomcat7 in the same machine.
First time I am using FarmWarDeployer. I only knows that using this we can
deploy our application in one node in the tomcat cluster rather than
diploying in all the nodes.
Then after some reading what I did is :
I created /tmp/war-deploy , /tmp/war-app , /tmp/war-listen and /war-temp
directories.

I started the tomcat. Here is the portion of the catalina.out file.

6 Aug, 2010 12:46:37 PM org.apache.catalina.ha.deploy.FarmWarDeployer start
INFO: Cluster deployment is watching /tmp/war-listen/ for changes.
6 Aug, 2010 12:46:37 PM org.apache.catalina.ha.deploy.FarmWarDeployer start
INFO: Cluster FarmWarDeployer started.
I understood that FarmWarDeployer started to work.

Now the following message is in the catalina.out in every 20 sec.

INFO: check cluster wars at /tmp/war-listen
6 Aug, 2010 12:53:23 PM org.apache.catalina.ha.deploy.WarWatcher check
INFO: check cluster wars at /tmp/war-listen
6 Aug, 2010 12:53:43 PM org.apache.catalina.ha.deploy.WarWatcher check
INFO: check cluster wars at /tmp/war-listen
6 Aug, 2010 12:54:03 PM org.apache.catalina.ha.deploy.WarWatcher check


Now when I copy my webapplication in the /war-deploy , /tmp/war-app , then
there is no changes in the catalina.out log file. But when I copy my
application in /tmp/war-listen/ directory following message appears in the
log file :

6 Aug, 2010 1:01:56 PM org.apache.catalina.ha.deploy.WarWatcher check
INFO: check cluster wars at /tmp/war-listen
6 Aug, 2010 1:01:56 PM org.apache.catalina.ha.deploy.FarmWarDeployer
fileModified
INFO: Installing webapp[/sessionReplication2] from
/tmp/war-deploy/sessionReplication2.war
6 Aug, 2010 1:01:56 PM org.apache.catalina.ha.deploy.FarmWarDeployer remove
INFO: Cluster wide remove of web app /sessionReplication2
6 Aug, 2010 1:02:16 PM org.apache.catalina.ha.deploy.WarWatcher check
INFO: check cluster wars at /tmp/war-listen

What is happening and what I am lacking to work FarmWarDeployer.
Thanks

--------------------------------------------------------------------
mail2web - Check your email from the web at
http://link.mail2web.com/mail2web



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


Re: Is FarmWarDeployer is working?

Posted by Mark Eggers <it...@yahoo.com>.

Shammi,

I have something working for 3 Tomcat 6.0.29 nodes on Fedora 13 using Sun 
JRE/JDK 1.6.0_21. I've not tried undeploying a web application yet.

Here's what I've found so far on Tomcat 6.0.29.

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

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

This last is a guess, but it seemed logical (and works). Based on my reading of 
the scant documentation, the war file gets deployed there for Tomcat to run 
(hence the deployDir name). There is some noise in the documentation about 
deploying ROOT in this fashion, but I've not experimented with that yet.

I've not read the javadoc (yet) nor looked through the source code (on my list 
of things to do).

So basically, here's my Deployer configuration for a three node cluster running 
on one machine (fronted by Apache and load balanced via mod_jk).

Deployment node:
a. Change the [name] to fit your implementation or leave out the <Alias> 
elements.
b. Change $CATALINA_BASE/name to be your absolute path to the directory 

<Host name="localhost" appBase="webapps"
      unpackWARs="true" autoDeploy="true"
      xmlValidation="false" xmlNamespaceAware="false">
  <Alias>[a-host-name]</Alias>
  <Alias>[another-host-name]</Alias>
  <!-- cluster must go here in order to use farm deployment -->
  <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster">
    <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
          tempDir="$CATALINA_BASE/temp-dir/"
          deployDir="$CATALINA_BASE/webapps/"
          watchDir="$CATALINA_BASE/watch-dir/"
          watchEnabled="true"/>
  </Cluster>
</Host>

Other nodes:
a. Same notes apply - change [name] to suit your implementation or leave out 
<Alias>
b. Replace $CATALINA_BASE with the absolute path to the directory

<Host name="localhost"  appBase="webapps"
      unpackWARs="true" autoDeploy="true"
      xmlValidation="false" xmlNamespaceAware="false">
  <Alias>[a-host-name]</Alias>
  <Alias>[another-host-name]</Alias>
  <!-- cluster at host level for farm deployment -->
  <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster">
    <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
        tempDir="$CATALINA_BASE/temp-dir/"
        deployDir="$CATALINA_BASE/webapps/"
        watchDir="$CATALINA_BASE/watch-dir/"
        watchEnabled="false"/>
  </Cluster>
</Host>


I haven't tried this on the subversion trunk, and I've seen some recent commits 
to the clustering components.

Hopefully this will get you started.

. . . . just my two cents

/mde/

----- Original Message ----
From: Christopher Schultz <ch...@christopherschultz.net>
To: Tomcat Users List <us...@tomcat.apache.org>
Sent: Fri, August 6, 2010 7:44:21 AM
Subject: Re: Is FarmWarDeployer is working?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Shammi,

On 8/6/2010 5:28 AM, shammi@arosys.com wrote:
> I have created two instances of tomcat7 in the same machine. First
> time I am using FarmWarDeployer. I only knows that using this we can 
> deploy our application in one node in the tomcat cluster rather than 
> deploying in all the nodes.

Unfortunately, there isn't much documentation on the FarmWarDeployer.
Here's what I've been able to find:

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

...which gives a configuration example:

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

It also says:

"
The default tomcat cluster supports farmed deployment, ie, the cluster
can deploy and undeploy applications on the other nodes. The state of
this component is currently in flux but will be addressed soon. There
was a change in the deployment algorithm between Tomcat 5.0 and 5.5 and
at that point, the logic of this component changed to where the deploy
dir has to match the webapps directory.
For more info, Please visit the reference documentation
"

I suspect the phrase "the cluster" in the first sentence really means
"one particular node in the cluster".

The "reference documentation" mention at the end is currently blank :(

There is also, of course, the javadoc:

http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/ha/deploy/FarmWarDeployer.html


The documentation seems all messed-up: The javadoc says "deployDir - the
directory where we watch for changes" and "applicationDir - the
directory where we install applications" but it's clear that the former
is where the apps are installed, the latter is fictional, and the real
"watch directory" is called "watchDir".

> Then after some reading what I did is :
> I created /tmp/war-deploy , /tmp/war-app , /tmp/war-listen and /war-temp
> directories.

Good. What is /tmp/war-app for? What does your <Deployer> element look
like? I suspect something like this:

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

> I started the tomcat. Here is the portion of the catalina.out file.
> 
> 6 Aug, 2010 12:46:37 PM org.apache.catalina.ha.deploy.FarmWarDeployer start
> INFO: Cluster deployment is watching /tmp/war-listen/ for changes.
> 6 Aug, 2010 12:46:37 PM org.apache.catalina.ha.deploy.FarmWarDeployer start
> INFO: Cluster FarmWarDeployer started.
> I understood that FarmWarDeployer started to work.

Looks good.

> Now the following message is in the catalina.out in every 20 sec.
> 
> INFO: check cluster wars at /tmp/war-listen
> 6 Aug, 2010 12:53:23 PM org.apache.catalina.ha.deploy.WarWatcher check

Sounds like it's polling that directory, which would appear to be normal
operation (though that IMO should probably be a DEBUG message, and not
INFO).

> Now when I copy my webapplication in the /war-deploy , /tmp/war-app , then
> there is no changes in the catalina.out log file.

Don't do that: the only place you should put your file is in
/tmp/war-listen.

> But when I copy my
> application in /tmp/war-listen/ directory following message appears in the
> log file :
> 
> 6 Aug, 2010 1:01:56 PM org.apache.catalina.ha.deploy.WarWatcher check
> INFO: check cluster wars at /tmp/war-listen
> 6 Aug, 2010 1:01:56 PM org.apache.catalina.ha.deploy.FarmWarDeployer
> fileModified
> INFO: Installing webapp[/sessionReplication2] from
> /tmp/war-deploy/sessionReplication2.war
> 6 Aug, 2010 1:01:56 PM org.apache.catalina.ha.deploy.FarmWarDeployer remove
> INFO: Cluster wide remove of web app /sessionReplication2

This is probably because it's undeploying the webapp you deployed
improperly by copying it into the /tmp/war-deploy directory.

> 6 Aug, 2010 1:02:16 PM org.apache.catalina.ha.deploy.WarWatcher check
> INFO: check cluster wars at /tmp/war-listen

Try stopping all instances of Tomcat, removing all files from
/tmp/war-*, deleting all of Tomcat's "work" directories, and then
starting all Tomcat instances.

Then, copy your WAR file into /tmp/war-listen and see what happens.

It's unclear to me whether the configuration on all of the nodes in the
cluster should be the same. For instance, if you have two Tomcat
instances on the same server with watchDir=/tmp/war-listen, then both
instances will be watching the same directory and trying to deploy to
the cluster. They are likely to interfere with each other.

Consider using /tmp/war-listen_1 and /tmp/war_listen_2, and
/tmp/war-deploy_1 and /tmp/war_deploy_2, etc.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxcH8UACgkQ9CaO5/Lv0PCJXQCePplQfy3bdJy5uhJ7PzKPcdOa
6ZIAoL4NE5NvJM4FG+4Hl46RN5LbX1yE
=KfyE
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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: Is FarmWarDeployer is working?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Shammi,

On 8/6/2010 5:28 AM, shammi@arosys.com wrote:
> I have created two instances of tomcat7 in the same machine. First
> time I am using FarmWarDeployer. I only knows that using this we can 
> deploy our application in one node in the tomcat cluster rather than 
> deploying in all the nodes.

Unfortunately, there isn't much documentation on the FarmWarDeployer.
Here's what I've been able to find:

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

...which gives a configuration example:

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

It also says:

"
The default tomcat cluster supports farmed deployment, ie, the cluster
can deploy and undeploy applications on the other nodes. The state of
this component is currently in flux but will be addressed soon. There
was a change in the deployment algorithm between Tomcat 5.0 and 5.5 and
at that point, the logic of this component changed to where the deploy
dir has to match the webapps directory.
For more info, Please visit the reference documentation
"

I suspect the phrase "the cluster" in the first sentence really means
"one particular node in the cluster".

The "reference documentation" mention at the end is currently blank :(

There is also, of course, the javadoc:

http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/ha/deploy/FarmWarDeployer.html

The documentation seems all messed-up: The javadoc says "deployDir - the
directory where we watch for changes" and "applicationDir - the
directory where we install applications" but it's clear that the former
is where the apps are installed, the latter is fictional, and the real
"watch directory" is called "watchDir".

> Then after some reading what I did is :
> I created /tmp/war-deploy , /tmp/war-app , /tmp/war-listen and /war-temp
> directories.

Good. What is /tmp/war-app for? What does your <Deployer> element look
like? I suspect something like this:

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

> I started the tomcat. Here is the portion of the catalina.out file.
> 
> 6 Aug, 2010 12:46:37 PM org.apache.catalina.ha.deploy.FarmWarDeployer start
> INFO: Cluster deployment is watching /tmp/war-listen/ for changes.
> 6 Aug, 2010 12:46:37 PM org.apache.catalina.ha.deploy.FarmWarDeployer start
> INFO: Cluster FarmWarDeployer started.
> I understood that FarmWarDeployer started to work.

Looks good.

> Now the following message is in the catalina.out in every 20 sec.
> 
> INFO: check cluster wars at /tmp/war-listen
> 6 Aug, 2010 12:53:23 PM org.apache.catalina.ha.deploy.WarWatcher check

Sounds like it's polling that directory, which would appear to be normal
operation (though that IMO should probably be a DEBUG message, and not
INFO).

> Now when I copy my webapplication in the /war-deploy , /tmp/war-app , then
> there is no changes in the catalina.out log file.

Don't do that: the only place you should put your file is in
/tmp/war-listen.

> But when I copy my
> application in /tmp/war-listen/ directory following message appears in the
> log file :
> 
> 6 Aug, 2010 1:01:56 PM org.apache.catalina.ha.deploy.WarWatcher check
> INFO: check cluster wars at /tmp/war-listen
> 6 Aug, 2010 1:01:56 PM org.apache.catalina.ha.deploy.FarmWarDeployer
> fileModified
> INFO: Installing webapp[/sessionReplication2] from
> /tmp/war-deploy/sessionReplication2.war
> 6 Aug, 2010 1:01:56 PM org.apache.catalina.ha.deploy.FarmWarDeployer remove
> INFO: Cluster wide remove of web app /sessionReplication2

This is probably because it's undeploying the webapp you deployed
improperly by copying it into the /tmp/war-deploy directory.

> 6 Aug, 2010 1:02:16 PM org.apache.catalina.ha.deploy.WarWatcher check
> INFO: check cluster wars at /tmp/war-listen

Try stopping all instances of Tomcat, removing all files from
/tmp/war-*, deleting all of Tomcat's "work" directories, and then
starting all Tomcat instances.

Then, copy your WAR file into /tmp/war-listen and see what happens.

It's unclear to me whether the configuration on all of the nodes in the
cluster should be the same. For instance, if you have two Tomcat
instances on the same server with watchDir=/tmp/war-listen, then both
instances will be watching the same directory and trying to deploy to
the cluster. They are likely to interfere with each other.

Consider using /tmp/war-listen_1 and /tmp/war_listen_2, and
/tmp/war-deploy_1 and /tmp/war_deploy_2, etc.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxcH8UACgkQ9CaO5/Lv0PCJXQCePplQfy3bdJy5uhJ7PzKPcdOa
6ZIAoL4NE5NvJM4FG+4Hl46RN5LbX1yE
=KfyE
-----END PGP SIGNATURE-----

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