[Mongrel] mongrel_rails start and restart differences

Anthony Ettinger ettinger at gmail.com
Tue Dec 2 14:03:13 EST 2008


On Tue, Dec 2, 2008 at 7:15 AM, Matt Davies <lists at ruby-forum.com> wrote:
> Hello everyone.
>
> I've got a rails application that is using 3 mongrels that sit behind
> nginx.  I'm  monitoring the mongrels, nginx and mysql with Munin and I'm
> restarting the processes when they hit certain levels with God.
>
> Can someone shed some light on this for me.
>
> I'm starting the mongrels off with this command, looping through 3
> ports.
>
> mongrel_rails start -d -e production -a 127.0.0.1 -c
> /var/www/rails/daughter/current -p #{port} -P
> /var/www/conf/log/mongrel.#{port}.pid -l
> /var/www/conf/log/mongrel.#{port}.log.
>
> If my mongrels start chewing up too much memory I restart them like so
>
> mongrel_rails restart -P /var/www/conf/log/mongrel.#{port}.pid
>
> All works well.  The problem is that munin does not record the mongrel
> after it's been restarting as the restarted mongrel runs underneath a
> ruby process as opposed to a mongrel_rail process.
>
> Here's what ps aux | grep mongrel_rails outputs after one mongrel has
> restarted.
>
> /USR/BIN/RUBY1.8 /USR/BIN/MONGREL_RAILS START -D -E PRODUCTION -A
> 127.0.0.1 -C /VAR/WWW/RAILS/DAUGHTER/CURRENT -P 5001 -P
> /VAR/WWW/CONF/LOG/MONGREL.5001.PID -L /VAR/WWW/CONF/LOG/MONGREL.5001.LOG
>
> RUBY /USR/LIB/RUBY/GEMS/1.8/GEMS/MONGREL-1.1.5/BIN/MONGREL_RAILS START
> -D -E PRODUCTION -A 127.0.0.1 -C /VAR/WWW/RAILS/DAUGHTER/CURRENT -P 5000
> -P /VAR/WWW/CONF/LOG/MONGREL.5000.PID -L
> /VAR/WWW/CONF/LOG/MONGREL.5000.LOG
>
> I've capitalised them all so don't worry about the switches, any ideas
> why mongrel_rails start does this
>
> /USR/BIN/RUBY1.8 /USR/BIN/MONGREL_RAILS START
>
> but mongrel_rails restart does this
> RUBY /USR/LIB/RUBY/GEMS/1.8/GEMS/MONGREL-1.1.5/BIN/MONGREL_RAILS START
>


I have you tried mongrel_cluster_restart ?

You can define a config file which says how many servers to startup,
and what port # to start at (ie: 9000).
You can also do a --clean to remove old pid files.



-- 
Anthony Ettinger
408-656-2473
http://anthony.ettinger.name


More information about the Mongrel-users mailing list