如何做一个滚动重新启动的一群mongrels [英] How to do a rolling restart of a cluster of mongrels

查看:161
本文介绍了如何做一个滚动重新启动的一群mongrels的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都知道一个很好的方法,通过capistrano以滚动的方式重新启动一个mongrel群集,例如,一次一个杂种。在这里以及每一个等待时间都很好,让mongrel也加载rails应用程序。



我做了一些搜索,没有找到太多,所以寻找帮助,然后我潜入到mongrel_cluster宝石我自己。



谢谢!

解决方案

我同意跷跷板方法比您正在寻找的滚动方法。问题是你最终会遇到这样的情况:在转换过程中,负载平衡可能会在应用程序的不同版本之间来回传播。



我们提出的解决方案(在找到SeeSaw之前,我们不使用)是从负载平衡器中脱离一半的mongrels。关闭他们更新它们启动它们把这些麻将放回负载平衡器,然后把另一半关掉。关闭下半场。更新下半年。启动它们这大大减少了同时运行应用程序的两个不同版本的时间。
我写了一个windows bat文件来做到这一点。 (不推荐在Windows上部署,btw)



注意,进行数据库迁移可以使整个方法有点危险是非常重要的。如果您只有附加迁移,则可以在部署之前随时运行这些迁移。如果要删除列,则需要在部署之后执行此操作。如果您正在重命名列,最好将其拆分为创建新列并将数据复制到迁移中以在部署前运行,并单独执行脚本以在部署后删除旧列。实际上,如果您没有做出特别的努力来组织它们,那么在生产数据库中通常使用常规迁移可能是危险的。所有这些都意味着更频繁的交付,所以每次更新都是较低的风险和较少的复杂性,但这是另一个回应的主题。


Anybody know a nice way to restart a mongrel cluster via capistrano in a "rolling" style, eg, one mongrel at a time. Would be great to have a bit of wait time in there as well for each, to let the mongrel load the rails app up as well.

I've done some searching, and haven't found too much, so looking for help before I dive into the mongrel_cluster gem myself.

Thanks!

解决方案

I agree with the seesaw approach more than the rolling approach you are seeking. The problem is that you end up in situations where load balancing can throw users back and forth between different versions of the application while you are transitioning.

The solutions we came up with (before finding SeeSaw, which we don't use) was to take half of the mongrels off line from the load balancer. Shut them down. Update them. Start them up. Put those mongrels back online in the load balancer and take the other half off. Shut the second half down. Update the second half. Start them up. This greatly minimizes the time where you have two different versions of the application running simultaneously. I wrote a windows bat file to do this. (Deploying on Windows is not recommended, btw)

It is very important to note that having database migrations can make the whole approach a little dangerous. If you have only additive migrations, you can run those at any time before the deployment. If you are removing columns, you need to do it after the deployment. If you are renaming columns, it is better to split it into a create a new column and copy data into it migration to run before deployment and a separate script to remove the old column after deployment. In fact, it may be dangerous to use your regular migrations on a production database in general if you don't make a specific effort to organize them. All of this points to making more frequent deliveries so each update is lower risk and less complex, but that's a subject for another response.

这篇关于如何做一个滚动重新启动的一群mongrels的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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