Check Mysql Status

本文涉及的产品
RDS MySQL DuckDB 分析主实例,集群系列 4核8GB
简介: Check MySQL Slave's Runnning Status
#!/bin/bash   

#  Check MySQL Slave Runnning Status 
#  crontab :*/10 * * * * 
#  show slave status


IP=`ifconfig eth0|grep "inet addr" | awk -F[:" "]+ '{print $4}'`  
STATUS=$(/usr/bin/mysql -uroot -p11111 -e "show slave status\G" | grep -i "running")  
IO_env=`echo $STATUS | grep IO | awk  ' {print $2}'`  
SQL_env=`echo $STATUS | grep SQL | awk  '{print $2}'`  

logFile=/data/mysqlbackup/logs/CheckMysqlStatus.log
DATE=`date +"%Y%m%d_%H:%M:%S"` 
  
if [ "$IO_env" = "Yes" -a "$SQL_env" = "Yes" ]  
then  
  echo "MySQL Slave is running!"  
else  
  echo "####### $DATE #########">> $logFile
  echo "MySQL Slave is not running!" >>    $logFile
  echo "MySQL Slave is not running!" | mail -s "WARN! $IP MySQL Slave is not running." admin@yourdomain.com  
fi  

相关实践学习
每个IT人都想学的“Web应用上云经典架构”实战
本实验从Web应用上云这个最基本的、最普遍的需求出发,帮助IT从业者们通过“阿里云Web应用上云解决方案”,了解一个企业级Web应用上云的常见架构,了解如何构建一个高可用、可扩展的企业级应用架构。
MySQL数据库入门学习
本课程通过最流行的开源数据库MySQL带你了解数据库的世界。   相关的阿里云产品:云数据库RDS MySQL 版 阿里云关系型数据库RDS(Relational Database Service)是一种稳定可靠、可弹性伸缩的在线数据库服务,提供容灾、备份、恢复、迁移等方面的全套解决方案,彻底解决数据库运维的烦恼。 了解产品详情: https://www.aliyun.com/product/rds/mysql 
目录
相关文章
|
SQL 数据采集 关系型数据库
如何解决MySQL报错 You have an error in your SQL syntax; check the manual that corresponds to your MySQL?
如何解决MySQL报错 You have an error in your SQL syntax; check the manual that corresponds to your MySQL?
14479 2
|
SQL 关系型数据库 MySQL
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
错误提示: Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; che
343 0
|
关系型数据库 MySQL
【MySQL进阶之路 | 基础篇】约束之CHECK约束与DEFAULT约束
【MySQL进阶之路 | 基础篇】约束之CHECK约束与DEFAULT约束
|
SQL 关系型数据库 MySQL
You have an error in your SQL syntax;check the manual that corresponds to you Mysql server version
You have an error in your SQL syntax;check the manual that corresponds to you Mysql server version
|
SQL 存储 关系型数据库
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server
|
SQL 关系型数据库 MySQL
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
|
SQL 关系型数据库 MySQL
mysql从库SHOW SLAVE STATUS字段详解
mysql从库SHOW SLAVE STATUS字段详解
890 0
|
SQL 关系型数据库 MySQL
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
786 0
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
|
关系型数据库 MySQL Linux
DVWA CentOS Could not connect to the MySQL service. Please check the config file.
DVWA CentOS Could not connect to the MySQL service. Please check the config file.
201 0
|
SQL 关系型数据库 MySQL
check the manual that corresponds to your MySQL server version for the right syntax to use near lin
注意这种一般情况下是语法问题,说明mysql的各种语句还是不够熟练, (1)看表名是不是使用了Mysql的关键字,如果是,请立马改掉; (2)语句给出哪里错误,如我的题目中给出“near”,说明在那附近有问题。 (3)检查mybatis中mapper里sql语句占位符是否写对,我的问题是将#{name}写成了#(name),尴尬。
1155 0

推荐镜像

更多