Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql automatically handles synchronous error reporting code sharing

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

The main content of this article is "Mysql automatic processing synchronous error code sharing", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "Mysql automatic processing synchronous error code sharing"!

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-fused Mysql'/ 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 here, I believe you have a deeper understanding of" Mysql automatic processing synchronous error code sharing ", you might as well to actually do it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report