mysql3306 Port down#!/bin/bash##### #mysql monitor# #while:d osleep 80/usr/bin/nc localhost 3306-w 2 &>/dev/nullh= 0if [-ne 0];then/etc/init.d/mysql start fidone#!/bin/bash##### #mysql monitor# #while:d osleep 80/usr/bin/nc Localhos T 3306-w 2 &>/dev/nullh=0if [-ne 0];then mysqld--defaults-file=/data/mysqlc/my_cluster/conf/my.cnf--us er=mysql& Sleep mysql-u root-pdota.123-e "Select Memc_servers_set (' 10.200.240.225:11211 ');" Fidone80 seconds to detect MySQL service, request local 3306 Port 2 times failed, restart service
NDB Cluster Management node #!/bin/bashndb_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/ETCFI
NDB Cluster Management node ndb_mgm= ' pgrep ndb_mgm ' if ["$ndb _mgm" = = ""];then/data/mysqlc/bin/ndb_mgmd-f/data/mysql/etc/config.ini- -configdir=/data/mysql/etcfi
NDB Cluster Data node #/bin/shwhile 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 300done
This article is from the "my operation and maintenance of the road" blog, declined reprint!
Monitor MySQL, NDB process restart