1. Environment
OS : Linux
DBMS : MYSQL
2. Symptoms
모니터링 script에서 “mysqld_safe” 만 모니터한다면 문제 발생
2014년에 고객사에서 위와같이 script를 구성해서 DB가 깨진 사례
핵심 DB process는 “mysqld” 이고 “mysqld_safe”는 mysqld를 모니터하는 watchdog
3. Solution
- mysqld가 없으면 mysqld_safe를 한번더 체크
( mysqld_safe가 없으면 mysqld를 stop하고 종료)
(sample)
#!/bin/sh
ps -ef|grep “/usr/libexec/mysqld –basedir=/usr –datadir=/mysql_data” |grep -v grep > /dev/null
if [ $? -eq 1 ]; then
ps -ef|grep “mysqld_safe” |grep -v grep > /dev/null
if [ $? -eq 1 ]; then
exit 1
fi
exit 0
fi
ps -ef|grep “mysqld_safe” |grep -v grep > /dev/null
if [ $? -eq 1 ]; then
service mysqld stop
sleep 5
exit 1
fi
exit 0