简体   繁体   English

如何无缝地在Tomcat中重新部署战争?

[英]How to redeploy a war in tomcat seamlessly?

I just packaged my maven web application into a war file, upload it to remote server which has installed the tomcat environment. 我只是将我的Maven Web应用程序打包到一个war文件中,然后将其上传到安装了tomcat环境的远程服务器上。 After I unpacked my war file and put all files in the /webapps/ROOT directory, I run bin/startup.sh to fire up the tomcat. 解压缩war文件并将所有文件放在/webapps/ROOT目录中后,我运行bin/startup.sh启动Tomcat。

This just works fine, but when I intend to change my web application and redeploy it on the server, I don't know how to do that seamlessly , that is to say, not letting the users who is using my website lose any request . 这样做很好,但是当我打算更改Web应用程序并将其重新部署到服务器上时,我不知道如何无缝地进行操作,也就是说, 不要让正在使用我网站的用户丢失任何请求

Could anyone give me some idea? 谁能给我一些想法? Thanks a lot! 非常感谢!

You can always use manager app coming with tomcat to deploy a war without bringing the website down, even from a remote machine using browser. 您始终可以使用tomcat附带的管理器应用来部署战争,而无需关闭网站,即使是使用浏览器的远程计算机也是如此。

http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html#Deploy_A_New_Application_Remotely http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html#Deploy_A_New_Application_Remotely

You may use reverse proxy as door of you site. 您可以使用反向代理作为站点的门户。 After deploying your "second" war into Tomcat, you can change the configuration of reverse proxy and reload it. 在将“第二次”战争部署到Tomcat之后,您可以更改反向代理的配置并重新加载它。 The reloading of reverse proxy is very speedy, so that it likes "seamless" re-deployment of Java web application. 反向代理的重新加载非常迅速,因此它喜欢Java Web应用程序的“无缝”重新部署。 After the reloading of reverse proxy, you could un-deploy "first" war of application safely. 重新加载反向代理后,您可以安全地取消部署“第一次”应用程序之战。

This way to re-deploy is especially useful if the application needs time for initialization(for example: including ORM, Spring Framework...). 如果应用程序需要时间进行初始化(例如:包括ORM,Spring Framework ...),则这种重新部署方法特别有用。

There are few concerns about using multiple-war-at-the-same-time: 很少有人会同时使用多次战争:

1) There will be two applications(although, temporary) running on your Tomcat concurrently, make sure there is nothing hazard about concurrent executing. 1)Tomcat上将同时运行两个应用程序(尽管是临时的),请确保并发执行没有任何危险。 For example: scheduled jobs 例如:预定作业

2) You need to confirm that there is enough memory on Tomcat to live with two web applications, or Tomcat may hang. 2)您需要确认Tomcat上有足够的内存来容纳两个Web应用程序,否则Tomcat可能会挂起。

3) Be meticulous about Java.lang.OutOfMemory: PermGen Space problem 3)对Java.lang.OutOfMemory谨慎:PermGen空间问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何配置tomcat每次重新部署战争? - How to configure tomcat to redeploy war every time? 如何在不删除/取消部署旧应用程序的情况下在tomcat中重新部署war文件? - How to redeploy war file in tomcat without deleting/undeploy the old application? 重新部署战争时是否需要重新启动tomcat? - Is it necessary to restart tomcat when redeploy a war? 重新部署tomcat Live生产服务器的战争 - Redeploy war on tomcat live productive server 如何使用maven-tomcat7-plugin在Tomcat上适当地热部署/重新部署战争? - How to properly hot deploy/redeploy war on Tomcat with maven-tomcat7-plugin? 如何重新部署运行在Tomcat上的一类Web应用程序? - How to redeploy one class of webapp running on tomcat? Apache Tomcat6:是否可以自动检测战争的新版本,下载并重新部署? - Apache Tomcat6: Is it possible to auto detect a new version of a war, download and redeploy? 如何在不影响Tomcat的情况下替换已编译jar中的文件 - How to replace file in compiled jar without affectig Tomcat redeploy 在 Wildfly 中重新部署战争时出现 ClassCastingException - ClassCastingException when redeploy war in wildfly 使用Tomcat配置时如何在Idea中重新部署JavaScript - How do you redeploy javascript in Idea when using a Tomcat configuration
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM