我目前正在为Q&A开发Tomcat集群,但不幸的是,整个集群中war的自动部署似乎根本不起作用。
我知道集群运行得很好,因为每个服务器都正确地接收了多播通信,并且立即意识到任何丢失的主机。
这里的问题来自于FarmWarDeployer函数,它似乎不起作用。
实际上,当我使用tomcat管理器或简单的SFTPd推送在集群的node1上上传war时,war是由node1解压缩和使用的,但是它没有发送到我的节点2。相反,我的node1是这样说的:
警告: Manager localhost#/APPTest#1.0.0:没有上下文管理器在9/14/12发送5:21下午103ms内收到。
我的node2声称:
警告:上下文管理器不存在:localhost#/APPTest#1.0.0
好的,如果我手动将应用程序推送到APPTest上,那么使用标记正确设置我的node2,并且集群将正确地接收会话。
因此,关于我,问题来自于我的FarmWarDeployer设置,这些设置是:
103 <Engine name="Catalina" defaultHost="localhost">
104
105
106
107 <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
108 channelSendOptions="8">
109
110 <Manager className="org.apache.catalina.ha.session.DeltaManager"
111 expireSessionsOnShutdown="false"
112 notifyListenersOnReplication="true"/>
113
114 <Channel className="org.apache.catalina.tribes.group.GroupChannel">
115 <Membership className="org.apache.catalina.tribes.membership.McastService"
116 address="224.0.0.1"
117 port="45564"
118 frequency="500"
119 dropTime="3000"/>
120 <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
121 address="auto"
122 port="4000"
123 autoBind="100"
124 selectorTimeout="5000"
125 maxThreads="6"/>
126
127 <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
128 <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
129 </Sender>
130 <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
131 <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/>
132 </Channel>
133
134 <Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
135 filter=""/>
136 <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>
137
138 <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
139 tempDir="/opt/tomcat/temp/"
140 deployDir="/opt/tomcat/webapps/"
141 watchDir="/opt/tomcat/webapps/"
142 watchEnabled="enable"/>
143
144 <ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
145 <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
146 </Cluster>
147
148 <Realm className="org.apache.catalina.realm.LockOutRealm">
149 <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
150 resourceName="UserDatabase"/>
151 </Realm>
152
153 <Host name="localhost" appBase="webapps"
154 unpackWARs="true" autoDeploy="true">
155 </Host>
156 </Engine>关于我,对于测试集群来说,没有什么太奇怪的,但我绝对不是一个tomcat专家。
所以,如果有什么不对劲或遗漏了,请告诉我;-)
发布于 2015-03-31 04:43:07
FarmWarDeployer只能在主机级群集上配置。群集设置移到<Host>...</Host>中。对我来说很管用。
https://tomcat.apache.org/tomcat-7.0-doc/config/cluster-deployer.html
发布于 2013-07-19 19:29:59
您的watchDir和deployDir不应该是同一个位置。当tomcat看到一个变化时,它会尝试下载它,并且会有一个不完整的流,因为没有什么是即时的。这将导致您在战争部署中看到的错误。如果您试图将war直接复制到deploy目录,也可以复制相同的场景。您首先需要在服务器上分阶段,而不是部署。
尝试为watchDir param添加另一个目录,而不是尝试部署到该目录中,所有节点都应该得到它。
https://serverfault.com/questions/429075
复制相似问题