经过一些专门的文档tomcat help page。 我使用了FarmWarDeployer的这个配置来配置两个tomcat 节点作为集群的一部分。
1: tempDir="\temp-dir\"
deployDir="\webapps\"
watchDir="\watch-dir\"
watchEnabled="true"/>
2: tempDir="\temp-dir\"
deployDir="\webapps\"
watchDir="\watch-dir\"
watchEnabled="false"/>
配置文件夹分别对应两个TOMCAT_BASE实例 1:C:\ tomcat1 2:C:\ tomcat2 我的TOMCAT_HOME是C:\ tomcat7。
第一个tomcat能够正确地从watchDir文件夹部署战争 从下面的日志中可以看出(为imp行添加了表情符号):
1 startInternal
2 INFO: Cluster is about to start
3 Jul 17, 2017 3:48:08 PM org.apache.catalina.tribes.transport.ReceiverBase
4 bind
5 INFO: Receiver Server Socket bound to:/192.168.1.8:4000
6 Jul 17, 2017 3:48:08 PM
7 org.apache.catalina.tribes.membership.McastServiceImpl setupSocket
8 INFO: Setting cluster mcast soTimeout to 500
9 Jul 17, 2017 3:48:08 PM
10 org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers
11 INFO: Sleeping for 1000 milliseconds to establish cluster membership, start
12 level:4
13 Jul 17, 2017 3:48:09 PM
14 org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers
15 INFO: Done sleeping, membership established, start level:4
16 Jul 17, 2017 3:48:09 PM
17 org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers
18 INFO: Sleeping for 1000 milliseconds to establish cluster membership, start
19 level:8
20 Jul 17, 2017 3:48:10 PM
21 org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers
22 INFO: Done sleeping, membership established, start level:8
23 Jul 17, 2017 3:48:10 PM org.apache.catalina.ha.deploy.FarmWarDeployer start
24:) INFO: Cluster deployment is watching [\watch-dir\] for changes.
25 Jul 17, 2017 3:48:10 PM org.apache.catalina.ha.deploy.FarmWarDeployer start
26:) INFO: Cluster FarmWarDeployer started.
27 Jul 17, 2017 3:48:10 PM org.apache.catalina.ha.session.JvmRouteBinderValve
28 startInternal
29 INFO: JvmRouteBinderValve started
30 Jul 17, 2017 3:48:10 PM org.apache.catalina.startup.HostConfig
31 deployDescriptor
32 INFO: Deploying configuration descriptor
33 C:\tomcat1\conf\Catalina\localhost\manager.xml
34 Jul 17, 2017 3:48:10 PM org.apache.catalina.startup.TldConfig execute
35 INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable
36 debug logging for this logger for a complete list of JARs that were scanned
37 but no TLDs were found in them. Skipping unneeded JARs during scanning can
38 improve startup time and JSP compilation time.
39 Jul 17, 2017 3:48:11 PM org.apache.catalina.startup.HostConfig
40 deployDescriptor
41 INFO: Deployment of configuration descriptor
42 C:\tomcat1\conf\Catalina\localhost\manager.xml has finished in 785 ms
43 Jul 17, 2017 3:48:11 PM org.apache.coyote.AbstractProtocol start
44 INFO: Starting ProtocolHandler ["http-bio-8081"]
45 Jul 17, 2017 3:48:11 PM org.apache.coyote.AbstractProtocol start
46 INFO: Starting ProtocolHandler ["ajp-bio-8009"]
47 Jul 17, 2017 3:48:11 PM org.apache.catalina.startup.Catalina start
48 INFO: Server startup in 3077 ms
49 Jul 17, 2017 3:48:31 PM org.apache.catalina.ha.deploy.FarmWarDeployer
50 fileModified
51:) INFO: Installing webapp [/catalogue] from [C:\tomcat1\webapps\catalogue.war]
52 Jul 17, 2017 3:48:31 PM org.apache.catalina.startup.HostConfig deployWAR
53:) INFO: Deploying web application archive C:\tomcat1\webapps\catalogue.war
54 Jul 17, 2017 3:48:31 PM org.apache.catalina.loader.WebappClassLoaderBase
55 validateJarFile
56 INFO:
57 validateJarFile(C:\tomcat1\webapps\catalogue\WEB-INF\lib\servlet-api-2.5.jar)
58 - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class:
59 javax/servlet/Servlet.class
60 Jul 17, 2017 3:48:31 PM org.apache.catalina.startup.TldConfig execute
61 INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable
62 debug logging for this logger for a complete list of JARs that were scanned
63 but no TLDs were found in them. Skipping unneeded JARs during scanning can
64 improve startup time and JSP compilation time.
65 Jul 17, 2017 3:48:31 PM org.apache.catalina.ha.session.DeltaManager
66 startInternal
67 INFO: Register manager /catalogue to cluster element Host with name
68 localhost
69 Jul 17, 2017 3:48:31 PM org.apache.catalina.ha.session.DeltaManager
70 startInternal
71 INFO: Starting clustering manager at /catalogue
72 Jul 17, 2017 3:48:31 PM org.apache.catalina.ha.session.DeltaManager
73 getAllClusterSessions
74 INFO: Manager [/catalogue]: skipping state transfer. No members active in
75 cluster group.
76 Jul 17, 2017 3:48:31 PM org.apache.catalina.startup.HostConfig deployWAR
77 INFO: Deployment of web application archive
78 :) C:\tomcat1\webapps\catalogue.war has finished in 359 ms
我的问题是: 1:为什么在第二个节点中没有发生自动部署。 2:MoreOver,第二个节点如何知道部署的战争 * watchEnabled * FALSE。
Tomcat:7.0.79 Apache:httpd-2.4.26-Win64-VC15 与mod_jk,提前谢谢。