monitを使用します。メモリまたはCPU使用率に基づいてmongrelを動的に再起動できます。ここに私のクライアントのために書いた設定ファイルの行があります。
check process mongrel-8000 with pidfile /var/www/apps/fooapp/current/tmp/pids/mongrel.8000.pid
start program = "/usr/local/bin/mongrel_rails cluster::start --only 8000"
stop program = "/usr/local/bin/mongrel_rails cluster::stop --only 8000"
if totalmem is greater than 150.0 MB for 5 cycles then restart # eating up memory?
if cpu is greater than 50% for 8 cycles then alert # send an email to admin
if cpu is greater than 80% for 5 cycles then restart # hung process?
if loadavg(5min) greater than 10 for 3 cycles then restart # bad, bad, bad
if 3 restarts within 5 cycles then timeout # something is wrong, call the sys-admin
if failed host 192.168.106.53 port 8000 protocol http request /monit_stub
with timeout 10 seconds
then restart
group mongrel
次に、すべてのmongrelクラスタインスタンスに対してこの設定を繰り返します。 monit_stub行は、monitがダウンロードしようとする空のファイルです。できない場合は、インスタンスを再起動しようとします。
注:リソース監視は、DarwinカーネルのOS Xでは動作しないようです。
もう一方を受け入れない場合は、少なくとも最初に「正しく」発注されます。 – Otto
あなた自身の答えを受け入れることができるようですので、私は持っています – AndrewR