简体   繁体   English

Spring Boot热装

[英]Spring boot hot reload

I'm using spring boot and uses the fat jar for production, which is pretty cool. 我使用的是弹簧靴,并使用胖子罐进行生产,这很酷。

However, the way I'm deploying forces the application to be shutdown for about 15 seconds when redeploying, because I have to kill the running jar and start the new one. 但是,我的部署方式在重新部署时强制将应用程序关闭大约15秒钟,因为我必须杀死正在运行的jar并启动新的jar。 I haven't found any solutions for this, ie how to reload the new jar without a restart. 我还没有找到任何解决方案,例如,如何在不重新启动的情况下重新加载新的jar。

Is it possible to "hot reload/replace" the jar or would I have to run in a container, like tomcat, and deploying a war? 是否可以“热装/更换”罐子,还是我必须在诸如tomcat的容器中运行并展开战争?

Please note that it's in production so I guess dev-tools is out of question. 请注意,它正在生产中,所以我想dev-tools毫无疑问。

It's more infrastructure question I guess. 我猜这是更多的基础设施问题。 You can create second "reserve"instance running your app. 您可以创建第二个“保留”实例来运行您的应用程序。 When you are updating your app on the main instance - all users requests must be redirected to the second "reserve" instance. 在主实例上更新应用程序时-所有用户请求都必须重定向到第二个“保留”实例。 When the redeploy is finished - you redirect the request to the main instance again. 重新部署完成后-您可以将请求再次重定向到主实例。 And then redeploy app on the reserve instance. 然后在预留实例上重新部署应用程序。 For example Nginx may help you with those redirections. 例如,Nginx可以帮助您进行这些重定向。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM