我已经设置了 apache-tomcat 集群(Ubuntu Server),我使用了 tomcat 支持的集群技术和 mod_jk链接。我已经设置了一个负载均衡器和两个 Web 服务器。
主要问题是部署 WAR 文件以及部署到哪个 Web 服务器?我了解了 Farmed Deployment,它将 war 文件部署到集群中的其他 tomcat 服务器,但我还没有让它工作。我在两个 Web 服务器上的元素中以以下方式使用了场部署器。
网络服务器 1(192.168.1.101)
<Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
tempDir="/usr/share/tomcat/temp/"
deployDir="/usr/share/tomcat/webapps/"
watchDir="/usr/share/tomcat/watch/"
watchEnabled="true"/>
Run Code Online (Sandbox Code Playgroud)
网络服务器 2(192.168.1.102)
<Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
tempDir="/usr/share/tomcat/temp/"
deployDir="/usr/share/tomcat/webapps/"
watchDir="/usr/share/tomcat/webapps/"
watchEnabled="false"/>
Run Code Online (Sandbox Code Playgroud)
我将 WAR 放在 web 服务器 1 上的 watch 目录中,但它没有部署到其他服务器。任何人都得到了这个工作,我做错了什么?,请告诉我!
谢谢!
更新:1
我可以在 catalina.out 日志中的任何一台机器中看到以下信息,
14 Aug, 2011 9:12:11 PM org.apache.catalina.ha.deploy.FarmWarDeployer start
SEVERE: FarmWarDeployer can only work as host cluster subelement!
Run Code Online (Sandbox Code Playgroud)
它甚至不部署到 webserver1,也不部署到 webserver2。访问网站时出现 404 错误。还有什么帮助...?还有一件事,我没有从 apt 存储库安装 tomcat,而是从源代码构建它,这对于我们的 Java 应用程序来说非常完美。
我已经mod_jk
在 ubuntu 服务器上设置了 apache-tomcat 集群。我在FarmDeployer
将 war 文件部署到集群中的其他 Web 服务器时遇到了一些问题,我希望它能像我发布的那样工作并使 FarmDeployer 在这里工作。
战争部署器与帖子中的以下配置完美配合,但不能可靠地工作,因为它有时会在访问页面时出现 404 错误:
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster">
<Channel className="org.apache.catalina.tribes.group.GroupChannel">
<Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
address="192.168.1.4"
port="4000"
selectorTimeout="100"
maxThreads="6"/>
<Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
<Interceptor className="org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor">
<Member className="org.apache.catalina.tribes.membership.StaticMember"
port="4000"
securePort="-1"
host="192.168.1.2"
domain="staging-cluster"
uniqueId="{0,1,2,3,4,5,6,7,8,9}"/>
</Interceptor>
</Channel>
<Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
tempDir="/usr/share/tomcat/temp/"
deployDir="/usr/share/tomcat/webapps/"
watchDir="/usr/share/tomcat/watch/"
watchEnabled="true"/>
</Cluster>
</Host>
Run Code Online (Sandbox Code Playgroud)
以下是完美适用于 HA 和 LB 集群的配置(来自 tomcat cluster docs)。But it fails in Farm Deployer
并且日志中没有任何说明农场部署程序不工作的原因。
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false"> …
Run Code Online (Sandbox Code Playgroud)