Nowe posty

Autor Wątek: Problem z serwerem Thin, nagłe pady  (Przeczytany 2436 razy)

axlinux

  • Gość
Problem z serwerem Thin, nagłe pady
« dnia: 2010-08-27, 14:06:29 »
Hej

Mam aplikację w Rails, działała ona przez pewien czas na serwerze Mongrel. Niestety oprogramowanie to było bardzo ślamazarne i często serwer się wyłączał bez jakieś przyczyny. Zmieniłem serwer na Thin. Przez kilka miesięcy nie było żadnego problemu. Teraz znów pojawił się syndrom padającego serwera. W ciągu kilku dni padł już drugi raz. Po prostu sam się wyłączył. W logach Rails nic szczególnego nie zauważyłem.

Serwer działa na Debianie. Czy ktoś może mi poradzić co zrobić?

Generalnie dobrym pomysłem by był jakiś program monitorujący czy Thin działa.

Dzięki za podpowiedzi jak poradzić sobie z Tym problemem.

axlinux

  • Gość
Problem z serwerem Thin, nagłe pady
« Odpowiedź #1 dnia: 2010-08-27, 18:53:23 »
Użyłem programu monit

Z takim wpisem:

set daemon 160
set mailserver localhost
set mail-format { from: monit@yourserver.com }
set alert myemail@domain.com
 
set httpd port 2020 and
    use address localhost  # only accept connection from localhost
    allow localhost        # allow localhost to connect to the server and

##### thin #####
check process my-thin-3000 with pidfile /home/tomek/Pulpit/test/thin.pid
    start program = "/usr/bin/ruby1.8 /usr/bin/thin --pid /home/tomek/Pulpit/test/thin.pid -p 3000 -e production -c /home/tomek/Pulpit/test/test -d start"
    stop program  = "/usr/bin/ruby1.8 /usr/bin/thin --pid /home/tomek/Pulpit/test/thin.pid stop"
 
    if totalmem is greater than 60.0 MB for 5 cycles then restart       # eating up memory?
    if cpu is greater than 50% for 2 cycles then restart                 # 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 3 restarts within 5 cycles then timeout                         # something is wrong, call the sys-admin

    if failed host localhost port 3000 then restart

group thin
Może mi ktoś powiedzieć czy to optymalne wpisy. ?