In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
In this issue, the editor will bring you an example analysis of MYSQL master-slave replication synchronization and monitoring Seconds Behind Master. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.
Today, I was asked by the boss how the newly built MYSQL replication synchronization is, whether there is an alarm or replication, the master is inconsistent, and how to call the police. We've monitored the seconds_behind_master, and there's no difference.
Don't you look at seconds_behind_master when you look at the main difference? there is no difference if it is 0.
So is it right for us to look at seconds_behind_master alone as a criterion for judging differences between master and subordinate?
Let's first take a look at the possibility of several values for SBM.
1 possibility of emptiness
When the seconds_behind_master is empty, there is a problem with your master-slave replication.
It may be that the master-slave replication is broken, or if SQL_THREAD is stopped, the state of NULL will appear.
2 cases greater than or equal to 0
When the situation is greater than 0, it is certain that the data of the master-slave database is inconsistent and there is a lag.
A value equal to 0 means that there is no delay for the SQL thread to parse the relay_log to the current slave library.
We can judge whether the slave library lags behind the master library by seeing whether SBM is 0 or not.
Wrong, there will be problems in the following situations
1 due to the performance problems of the master library, or network problems, there has been a delay in fetching binlog to the slave library itself, so can we still get the accurate gap between master and slave through SBM?
2 above is the source code implementation of computing SBM, in which the dark location clock_diff_with_master identifies the time difference between the master and slave libraries, but can you guarantee that it is stable and reliable to obtain the master and slave libraries at different times? If you can't guarantee that the system time difference between master and slave libraries at any moment is accurate, how can you say that SBM is accurate.
It is a little more reliable to accurately obtain the difference between master and slave.
First check to see if there is any difference between relay_master_log_file and master_log_file
In order to see if Exec_master_log_pos and read_master_log_pos are consistent, finally you are going to see if SBM is zero. In addition, parallel and serial replication also have an impact on SMB.
Of course, MYSQL, which has been replicated in GTID, can have a better way to judge whether there is a delay in master-slave replication at a certain point in time, or it is possible to use beatheart in the pt tool to judge.
How did GTID judge, and what kind of tool?
(in fact, to judge whether the master and slave are consistent, if you do it through the program, you can write a shell or python program, then generate a database table in the master database, insert a piece of data into the table every second, and obtain the data from the slave database query to determine whether the master-slave replication is consistent. In fact, this is the basic principle of judging the master-slave consistency in the pt tool.)
The above is the example analysis of MYSQL master-slave replication synchronization and monitoring Seconds Behind Master shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.