[Mongrel] [ANN] Another mongrel_cluster prerelease 1.0.1.1

Ezra Zygmuntowicz ezmobius at gmail.com
Thu Apr 12 16:43:27 EDT 2007


On Apr 12, 2007, at 1:35 PM, Michael A. Schoen wrote:

> Bradley Taylor wrote:
>> mongrel_rails stop accepts a --wait argument. If I add that to
>> mongrel_cluster, will it solve these issues?
>
> Not for me I don't think. Again, I may be misreading it, but that -- 
> wait
> argument just looks like it literally waits, then does a hard kill. I
> would have expected that option to send a TERM, then wait up to @wait
> seconds for it to go away, and do a KILL if it was still there. If  
> that
> were the implementation it sounds like it would work for most folks.
>
> I'm really just looking for the ability to do a restart, ie., a  
> graceful
> stop following by an automatic (within Mongrel) start.


	You can accomplish gracefull mongrel cluster restarts with monit.  
using cluster::stop and cluster::start in the start/stop programs.  
Set a 'mongrel' group in the monit config and then use this for the  
restart task:

$ sudo monit restart all -g mongrel

	That will do each mongrel one at a time and it will make sure they  
stop and get started again, avoiding the issue of starting a new  
mongrel on the same port before the other one finishes. This is what  
works best for me.

Cheers
-- Ezra Zygmuntowicz 
-- Lead Rails Evangelist
-- ez at engineyard.com
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)




check process mongrel_<%= @username %>_5000
   with pidfile /data/<%= @username %>/shared/log/mongrel.5000.pid
   start program = "/usr/bin/mongrel_rails cluster::start -C /data/<% 
= @username %>/current/config/mongrel_cluster.yml --clean --only 5000"
   stop program = "/usr/bin/mongrel_rails cluster::stop -C /data/<%=  
@username %>/current/config/mongrel_cluster.yml --clean --only 5000"
   if totalmem is greater than 110.0 MB for 4 cycles then  
restart       # eating up memory?
   if cpu is greater than 50% for 2 cycles then  
alert                  # send an email to admin
   if cpu is greater than 80% for 3 cycles then  
restart                # hung process?
   if loadavg(5min) greater than 10 for 8 cycles then  
restart          # bad, bad, bad
   if 20 restarts within 20 cycles then  
timeout                         # something is wrong, call the sys-admin
   group mongrel

check process mongrel_<%= @username %>_5001
   with pidfile /data/<%= @username %>/shared/log/mongrel.5001.pid
   start program = "/usr/bin/mongrel_rails cluster::start -C /data/<% 
= @username %>/current/config/mongrel_cluster.yml --clean --only 5001"
   stop program = "/usr/bin/mongrel_rails cluster::stop -C /data/<%=  
@username %>/current/config/mongrel_cluster.yml --clean --only 5001"
   if totalmem is greater than 110.0 MB for 4 cycles then  
restart       # eating up memory?
   if cpu is greater than 50% for 2 cycles then  
alert                  # send an email to admin
   if cpu is greater than 80% for 3 cycles then  
restart                # hung process?
   if loadavg(5min) greater than 10 for 8 cycles then  
restart          # bad, bad, bad
   if 20 restarts within 20 cycles then  
timeout                         # something is wrong, call the sys-admin
   group mongrel

check process mongrel_<%= @username %>_5002
   with pidfile /data/<%= @username %>/shared/log/mongrel.5002.pid
   start program = "/usr/bin/mongrel_rails cluster::start -C /data/<% 
= @username %>/current/config/mongrel_cluster.yml --clean --only 5002"
   stop program = "/usr/bin/mongrel_rails cluster::stop -C /data/<%=  
@username %>/current/config/mongrel_cluster.yml --clean --only 5002"
   if totalmem is greater than 110.0 MB for 4 cycles then  
restart       # eating up memory?
   if cpu is greater than 50% for 2 cycles then  
alert                  # send an email to admin
   if cpu is greater than 80% for 3 cycles then  
restart                # hung process?
   if loadavg(5min) greater than 10 for 8 cycles then  
restart          # bad, bad, bad
   if 20 restarts within 20 cycles then  
timeout                         # something is wrong, call the sys-admin
   group mongrel


More information about the Mongrel-users mailing list