# How to hack a mongrel cluster to restart in an alternating manner?

**URL:** <https://www.ruby-forum.com/t/how-to-hack-a-mongrel-cluster-to-restart-in-an-alternating-manner/159382>\
**Category:** Mongrel\
**Created:** [February 4, 2009, 2:18am UTC](https://www.ruby-forum.com/t/how-to-hack-a-mongrel-cluster-to-restart-in-an-alternating-manner/159382 "2009-02-04T02:18:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eblatt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7bcc69/32.png) [@eblatt](https://www.ruby-forum.com/u/eblatt)\
**Post date:** [February 4, 2009, 2:18am UTC](https://www.ruby-forum.com/t/how-to-hack-a-mongrel-cluster-to-restart-in-an-alternating-manner/159382/1 "2009-02-04T02:18:42Z")

</div>

Hello,

I’ve been trying (unsuccessfully) to hack my mongrel\_cluster to  
re-ststart  
in an alternating manner.

Specifically, this soluiton:  
[http://blog.carlmercier.com/2007/09/07/a-better-approach-to-restarting-a-mongrel-cluster/#content](http://blog.carlmercier.com/2007/09/07/a-better-approach-to-restarting-a-mongrel-cluster/#content)

Which means I an call to mongrel\_rails cluster::restart to do this:

mongrel\_rails start 8001  
mongrel\_rails stop 8001

mongrel\_rails start 8002  
mongrel\_rails stop 8002

mongrel\_rails start 8003  
mongrel\_rails stop 8003

mongrel\_rails start 8004  
mongrel\_rails stop 8004

Instead of:

mongrel\_rails stop 8001  
mongrel\_rails stop 8002  
mongrel\_rails stop 8003  
mongrel\_rails stop 8004

[…503…application offline…]

mongrel\_rails start 8001  
mongrel\_rails start 8002  
mongrel\_rails start 8003  
mongrel\_rails start 8004

(yuck!)

It’s has been very difficult for me to figure out where to install the  
hacked mongrel\_cluster\_ctl that Carl provides in his blog.  
The execution path is not clear.

Would anyone be willing to give me some ideas?

Thank you,  
Elliott

---

<div class="post-metadata">

**Author:** ![eblatt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7bcc69/32.png) [@eblatt](https://www.ruby-forum.com/u/eblatt)\
**Post date:** [February 4, 2009, 2:23am UTC](https://www.ruby-forum.com/t/how-to-hack-a-mongrel-cluster-to-restart-in-an-alternating-manner/159382/2 "2009-02-04T02:23:24Z")

</div>

I’ve had success with Eden Li’s patch here:  
[http://rubyforge.org/tracker/index.php?func=detail&aid=15427&group\_id=1306&atid=5147](http://rubyforge.org/tracker/index.php?func=detail&aid=15427&group_id=1306&atid=5147).  
Been using it in several production deploys for about 2 months.

If you’re interested (and too lazy to apply the patch yourself) you can  
take  
a look at my fork of mongrel that has mongrel\_cluster doing rolling  
restarts  
here:  
[Commits · chuyeow/mongrel · GitHub](http://github.com/chuyeow/mongrel/commits/stable_1-1)

You need to clone the repos, go into the projects/mongrel\_cluster  
directory,  
and run a rake task to package the gem.

Cheers,  
Chu Yeow
