简体   繁体   English

使用负载平衡器的Apache tomcat部署

[英]Apache tomcat deployment with load balancer

I am trying to come up with a simple procedure for production deployments. 我正在尝试为生产部署提出一个简单的过程。 I have 2 tomcat nodes, front ended by 2 apache nodes with a load balancer on top of apache nodes. 我有2个tomcat节点,前端是2个apache节点,在apache节点之上有一个负载均衡器。 For some reason I wont be able to do parallel deployments on Tomcats. 由于某种原因,我将无法在Tomcat上进行并行部署。 I am trying to use balancer-manager for during deployment in which I will make sure I drain tomcat node 1 before the application changes. 我正在尝试在部署期间使用balancer-manager,在该部署中,我将确保在应用程序更改之前先耗尽tomcat节点1。 I want to make sure I validate the changes on the tomcat node before I put the node in to live state. 我想确保在将tomcat节点置于活动状态之前,先对tomcat节点上的更改进行验证。 I know, at this point, I can take the apache node 1 offline from load balancer and change balancer-manager to route requests only to tomcat node 1 and point all my requests to Apache node 1 to validate before I go live. 我知道,这时,我可以使apache节点1从负载均衡器脱机,并更改balancer-manager以将请求仅路由到tomcat节点1,并将我的所有请求都指向Apache节点1进行验证,然后再上线。 I see this as a complex procedure to implement and I want to know if there is a better way I can achieve this. 我认为这是一个复杂的实现过程,我想知道是否有更好的方法可以实现这一目标。 Just an FYI we load balance requests between two apache nodes at F5 and we load balance requests between 2 tomcat nodes using Apache. 仅供参考,我们在F5的两个apache节点之间负载平衡请求,并使用Apache在2个tomcat节点之间负载平衡请求。

Any help? 有什么帮助吗?

There are three ways, I'm aware of: 我知道三种方式:

  1. Use a service registry/service discovery tool like consul.io 使用服务注册表/服务发现工具,例如consul.io
  2. Implement a health check into your application, which you can control during runtime. 在您的应用程序中实施运行状况检查 ,您可以在运行时对其进行控制。 The F5 will access then the health check resource and decide, whether the node is healthy. F5随后将访问运行状况检查资源,并确定该节点是否运行状况良好。 Right before the deployment you change the health state of the node to unhealthy and the node will be removed from the load balancing after a couple of seconds. 在部署之前,您将节点的运行状况更改为不正常,并且在几秒钟后,该节点将从负载平衡中删除。
  3. Use red/blue deployments : This means, every host carries two tomcats (the red and the blue tomcat). 使用红色/蓝色部署 :这意味着,每个主机都携带两个tomcat(红色和蓝色tomcat)。 Your Apache points either to the red or to the blue one. 您的Apache指向红色或蓝色。 By this approach, you deploy on the red tomcat and make sure your app is started. 通过这种方法,您可以在红色的tomcat上进行部署,并确保您的应用已启动。 Then you switch the config of the Apache to point on the red one and do a graceful restart - no requests are dropped. 然后,您将Apache的配置切换为指向红色的配置,并进行正常重启-不丢弃任何请求。 The blue is now inactive and the next time you deploy, you deploy to the blue tomcat and repeat the procedure. 蓝色的现在处于非活动状态,下次部署时,您将部署到蓝色的tomcat并重复该过程。

I used all methods in production and large ISPs. 我在生产环境和大型ISP中使用了所有方法。 Depends, on your infrastructure, application, and, how you want to deal with the HA issue. 取决于您的基础结构,应用程序以及您要如何处理HA问题。

HTH, Mark HTH,马克

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

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