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

A simple way to monitor whether the mysql master and slave is normal through shell

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

The following brings you a simple way to monitor mysql masters and followers through shell. If you are interested, let's take a look at this article. I believe that the simple method of monitoring mysql masters and followers through shell is more or less helpful to you.

Set scheduled tasks on master:

#! / bin/shif [- f / root/mysql_slave_status.txt] then rm-f / root/mysql_slave_status.txt mysql-uroot-pxxxxxx-e "show slave status\ G" | egrep "_ Running: | Behind_Master" | awk'{print $2}'> / root/mysql_slave_status.txt array= ($(cat / root/mysql_slave_status.txt | xargs)) if ["${array [0]}" = "Yes"-a " ${array [1]} "=" Yes "- a" ${array [2]} "=" 0 "] then echo" mysql slave is ok "``else char=" mysql slave is not ok "sleep 3 echo" $char "| mail-s" xxxxx mysql_slave is error "111111111@qq.com fi

Fi

Read the details of the simple way to monitor whether the mysql master and slave is normal through shell, and whether you have gained anything. If you want to know more about it, you can continue to follow our industry information section.

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

Servers

Wechat

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

12
Report