共计 1455 个字符,预计需要花费 4 分钟才能阅读完成。
本篇内容主要讲解“Mysql 自动处理同步报错代码分享”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让丸趣 TV 小编来带大家学习“Mysql 自动处理同步报错代码分享”吧!
export LANG=zh_CN
./root/.bash_profilev_dir=/usr/local/Mysql/bin/v_user=rootv_passwd=123456v_log=/home/logsv_times=10if [-d ${v_log} then echo ${v_log} has existed before. else mkdir ${v_log}fiecho ${v_log}/slave_status.logecho ${v_log}/slave_status_error.logcount=1while truedo Seconds_behind_master=$(${v_dir}Mysql -u${v_user} -p${v_passwd} -e show slave status\G; | awk -F : /Seconds_behind_master/{print $2} )if [${Seconds_behind_master}!= NULL then echo slave is ok! ${v_dir}Mysql -u${v_user} -p${v_passwd} -e show slave status\G; ${v_log}/slave_status.log breakelse echo ${v_log}/slave_status_error.log date ${v_log}/slave_status_error.log echo ${v_log}/slave_status_error.log ${v_dir}Mysql -u${v_user} -p${v_passwd} -e show slave status\G; ${v_log}/slave_status_error.log ${v_dir}Mysql -u${v_user} -p${v_passwd} -e show slave status\G; |egrep Delete_rows /dev/null 2 1 if [$?=0];then ${v_dir}Mysql -u${v_user} -p${v_passwd} -e stop slave;SET GLOBAL sql_slave_skip_counter=1;start slave; else ${v_dir}Mysql -u${v_user} -p${v_passwd} -e show slave status\G; |grep Last_SQL_Error break fi let count++ if [$count -gt ${v_times}];then break else ${v_dir}Mysql -u${v_user} -p${v_passwd} -e show slave status\G; ${v_log}/slave_status_error.log sleep 2 continue fifidone
到此,相信大家对“Mysql 自动处理同步报错代码分享”有了更深的了解,不妨来实际操作一番吧!这里是丸趣 TV 网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
正文完