maven deploy to tomcat cluster (multiple) in one line

主宰稳场 提交于 2019-12-05 20:08:53

If you need it to happen with only one line, I suggest executing a CMD, Ant, bash, etc. script as the "one-line" and make that script do more than one thing.

For instance, if you used Ant... Your one line could be something like this: ant DeployToCluster. And your build.xml file could have the target DeployToCluster which may include many steps. Think of it like refactoring out a method of code which does many things. The code which invokes your method becomes a one-liner.

You won't likely find a single command to do what you are after, unless it is just executing an existing script which someone else has written that does what you want.

Either way, it is usually a good idea to be able to deploy code to individual servers at a time. This lets you keep your app/service up at all times because you are only affecting one node at a time while the others can continue running. It also has the advantage that if something goes horribly wrong, you can just not re-enable the one node in the cluster and diagnose the one server's problem, as opposed to taking out your entire cluster with a bad deploy. The deploy strategy steps our script follows is:

  1. Disable monitoring of single node
  2. Pull that node out of cluster
  3. Deploy new code to it
  4. Verify node is operating properly with new code
  5. Put node back into cluster
  6. Re-enable monitoring for that node
  7. Repeat steps for every other node

If anything goes wrong at any step, we always have a working environment for our users.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!