Apache tomcat deployment with load balancer

593 views Asked by At

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. For some reason I wont be able to do parallel deployments on Tomcats. 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. I want to make sure I validate the changes on the tomcat node before I put the node in to live state. 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. 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.

Any help?

1

There are 1 answers

1
mp911de On

There are three ways, I'm aware of:

  1. Use a service registry/service discovery tool like 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. 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). Your Apache points either to the red or to the blue one. By this approach, you deploy on the red tomcat and make sure your app is started. Then you switch the config of the Apache to point on the red one and do a graceful restart - no requests are dropped. The blue is now inactive and the next time you deploy, you deploy to the blue tomcat and repeat the procedure.

I used all methods in production and large ISPs. Depends, on your infrastructure, application, and, how you want to deal with the HA issue.

HTH, Mark