[Mongrel] what is the correct way to stop/start a mongrel instance using monit with mongrel cluster

Michael Steinfeld mikeisgreat at gmail.com
Thu Aug 9 21:25:23 EDT 2007

Hi --

I have been reading documentation and googling around to find the
correct way to do this but I have found many ways that seem to not
work, or the documentation makes no reference to.

I am using mongrel cluster with 10 mongrels for each server. Recently
I installed monit but which lead me to find the correct way to
start/stop mongrel instances one pid at a time. I am assuming one pid
at a time is the correct way...

Currently, when I do a cap deploy we just kick mongrels with
/etc/init.d/mongrel_rails.. I am assuming I should be using monit now
when I deploy to do this. Correct? Can you give me an example of this?
I know this is not the monit list, but I was thinking you guys know
what I am talking about.

So in my monit.conf/monitrc file here is what I have:

check process mongrel_9001 with pidfile /var/run/mongrel/mongrel.9001.pid
  start program = "/usr/local/bin/mongrel_rails start -d -e production
-p 9009 -a -l log/mongrel.log -P
/var/run/mongrel/mongrel.9009.pid -c /home/app/current"
  stop program = "/usr/local/bin/mongrel_rails  stop -P

  if failed host port 9001 protocol http
    with timeout 10 seconds
    then restart

  if totalmem > 128 Mb then restart
  if cpu is greater than 60% for 2 cycles then alert
  if cpu > 90% for 5 cycles then restart
  if loadavg(5min) greater than 10 for 8 cycles then restart
  if 3 restarts within 5 cycles then timeout

Part of my confusion is if I should use mongrel_rails cluster::start
or mongrel_rails start, Is there a difference?

Any suggestions is really appreciated.

Michael Steinfeld
Linux Admin/Developer
AIM: mikesteinfeld

More information about the Mongrel-users mailing list