mysql3306端口down #!/bin/bash ######mysql monitor## while : do sleep 80 /usr/bin/nc localhost 3306 -w 2 &>/dev/null h=0 if [ -ne 0 ];then /etc/init.d/mysql start fi done #!/bin/bash ######mysql monitor## while : do sleep 80 /usr/bin/nc localhost 3306 -w 2 &>/dev/null h=0 if [ -ne 0 ];then mysqld --defaults-file=/data/mysqlc/my_cluster/conf/my.cnf --user=mysql& sleep 60 mysql -u root -pdota.123 -e "select memc_servers_set(‘10.200.240.225:11211‘);" fi done 80秒检测一次mysql 服务,请求本地3306端口2次失败,则重启服务
ndb集群管理节点 #!/bin/bash ndb_mgm=`ps aux|grep ndb_mgm|grep -v grep| wc -l` if [ "$ndb_mgm" == "0" ];then ndb_mgmd -f /data/mysql/etc/config.ini --configdir=/data/mysql/etc fi
ndb集群管理节点 ndb_mgm=`pgrep ndb_mgm` if [ "$ndb_mgm" == "" ];then /data/mysqlc/bin/ndb_mgmd -f /data/mysql/etc/config.ini --configdir=/data/mysql/etc fi
ndb集群data节点 #/bin/sh while true; do count=`ps -fe | grep "ndbd" | grep "defaults-file" | grep -v "grep"` if [ "$?" != "0" ]; then ndbd --defaults-file=/data/mysql/etc/my.cnf fi sleep 300 done
本文出自 “我的运维之路” 博客,谢绝转载!
原文:http://linuxpython.blog.51cto.com/10015972/1625949