mysql主从状态检测:
echo "show slave status\G;"|mysql -uroot -pyanghui|grep Running|awk -F: '{print $2}'|wc -c
MySQL运行状态检测:
echo "show processlist\G;"|mysql -uroot -pyanghui|grep -i host:|grep [0-9]|sed 's/Host://g'
转载于:https://blog.51cto.com/461205160/1754652