Capistrano可以连续在主机上执行任务吗? [英] Can Capistrano Execute Tasks on Hosts Consecutively?

查看:60
本文介绍了Capistrano可以连续在主机上执行任务吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Capistrano来管理在多个负载平衡服务器上运行的Java Web应用程序。某些任务(例如配置更改)需要重新启动服务器或重新部署应用程序,在此期间服务器将变得无响应。

I am using Capistrano to manage a Java web app that is running on several load balanced servers. Certain tasks (such as config changes) require a server restart, or app redeploy, during which the server becomes non-responsive.

如果Capistrano可以连续在服务器上执行这些任务,与并发相比,服务器场中一次只能关闭一台计算机,并且负载平衡器将确保不会丢失任何请求。但是,据我所知,Capistrano只在服务器上同时执行操作。

If Capistrano could perform these tasks on servers consecutively, vs. concurrently, only one machine in the farm would go down at a time, and the load balancer would ensure that no requests are lost. However, from what I can tell, Capistrano only performs operations on servers concurrently.

很明显,我不是在尝试连续执行不同的任务。我试图在不同的服务器上连续执行相同的任务。

To be clear, I'm not trying to execute different tasks consecutively. I'm trying to execute the same task on different servers consecutively.

我可以想到一些在我的配置中对其进行破解的方法,但是似乎应该有一个标记我可以在某个地方设置。

I can think of some ways of hacking this in my configuration, but it seems like there should be a flag I can set somewhere.

有人知道怎么做吗?

推荐答案

我用它来而不是并行地重新启动服务器:

I use this to restart my servers in series, instead of in parallel:

task :my_task, :roles => :web do
  find_servers_for_task(current_task).each do |server|
    run "[task command here]", :hosts => server.host
  end
end

这篇关于Capistrano可以连续在主机上执行任务吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆