Welcome to WebmasterWorld Guest from 54.147.20.131

Forum Moderators: bakedjake

Message Too Old, No Replies

Restart MySql Automatically from CRON

     

Anyango

7:47 am on Jul 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hello folks

i have been noticing that on a couple of my servers, mysql crashes away under high load and then i have to manually go to restart/start mysql.

is there a script out there somewhere or can we build a one which i set in CRON to execute each 30 mins and check if mysql is not running, run it. simple as that.
i did search for such scripts on web but couldnt find a one.

Environment: Red Hat Linux Enterprise.

any immediate help is highly appreciated.

lammert

9:06 am on Jul 22, 2006 (gmt 0)

WebmasterWorld Senior Member lammert is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



mysql crashes away under high load

This is not the normal behaviour of MySQL. Have you searched in the log files what the reason is for this crash? I am thinking of the system either running out of file descriptors or running out of memory / swap space.

If you can't find the reason for crashing, the following script can help you in CRON:

#!/bin/sh
NUMBER=`ps --no-heading --user mysql wc -l`
[ $NUMBER -eq 0 ] && put here your restart command

It first looks for all processes running as user mysql. It counts the number of lines in the output of PS and stores this in a variable. If this is equal to zero, it executes the command behind the &&.

You should replace the '' with the proper one without the hole in the center, because the posting software on this forum changes the original character.

Anyango

3:33 pm on Aug 2, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey which log shall i look at to find out why mysql keeps on crashing , i looked at mysql and apache logs but found nothing conclusive as to what causes those crashes.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month