当前位置:网站首页>Show slave status \ read in G_ Master_ Log_ POS and relay_ Log_ The (size) relationship of POS
Show slave status \ read in G_ Master_ Log_ POS and relay_ Log_ The (size) relationship of POS
2022-07-06 08:52:00 【wx5caecf2ed0645】
Just to clarify, there are three sets of file/position coordinates in SHOW SLAVE STATUS:
1) The position, ON THE MASTER, from which the I/O thread is reading:Master_Log_File/Read_Master_Log_Pos. ----- Relative to the main library , Where to read the binary log of the main library from the Library , yes IO Threads
2) The position, IN THE RELAY LOGS, at which the SQL thread is executing:Relay_Log_File/Relay_Log_Pos ---- Relative to slave Library , It's from the library sql Where the thread executes to
3) The position, ON THE MASTER, at which the SQL thread is executing:Relay_Master_Log_File/Exec_Master_Log_Pos ---- Relative to the main library , It's from the library sql Where the thread executes to
Numbers 2) and 3) are the same thing, but one is on the slave and the other is on the master.
mysql > show slave status \G
Master_Log_File: mysql-bin-m.000329
Read_Master_Log_Pos: 863952156 ---- The two lines above represent IO Threads , Binary files relative to the main library
Relay_Log_File: mysql-relay.003990
Relay_Log_Pos: 25077069 ---- The above two lines represent sql Threads , Relative to the relay log file of the slave Library
Relay_Master_Log_File: mysql-bin-m.000329
.....
Exec_Master_Log_Pos: 863936961--- The above two lines represent sql Threads , Relative to the main library
( For the convenience of demonstration , I advanced the above line .)
Relay_Log_Space: 25092264--- At present relay-log File size
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
You can see from above ,read_master_log_pos It will always be greater than exec_master_log_pos Value ( It could be the same ): Because a value represents io Threads , A value represents sql Threads ;sql The thread must be io After the thread .( Of course ,io Threads and sql Threads need to read and write the same file , Otherwise, the comparison will be meaningless ) .
stay binlog in ,Xid Represents the submitted transaction number . Now let's go to the master and slave libraries respectively , Check it out , In the main warehouse mysql-bin-m.000329 Of documents 863936961 Whether the location is the same as that of the slave Library mysql-relay.003990 Of documents 25077069 There are the same sql sentence .
First look at the main library binlog:
# at 863936961
#100111 20:11:39 server id 115000 end_log_pos 863937234 Query thread_id=515886 exec_time=0 error_code=0
use mall00/*!*/;
UPDATE mall00.t_item_sid88 SET item_end_time = 1263816699, item_is_online = 1, item_status = 1 WHERE iid IN (94322390, 94322428, 94322452, 94322473, 94322506, 94322532, 94322604, 94322641, 94322670, 94322706)/*!*/;
# at 863937234
#100111 20:11:39 server id 115000 end_log_pos 863937261 Xid = 1225244590
COMMIT/*!*/;
# at 863937261
#100111 20:11:39 server id 115000 end_log_pos 863937457 Query thread_id=515886 exec_time=0error_code=0
SET TIMESTAMP=1263211899/*!*/;
Look at the Library relaylog:
# at 25077069
#100111 20:11:39 server id 115000 end_log_pos863937234 Query thread_id=515886 exec_time=0 error_code=0
use mall00/*!*/;
UPDATE mall00.t_item_sid88 SET item_end_time = 1263816699, item_is_online = 1, item_status = 1 WHERE iid IN (94322390, 94322428, 94322452, 94322473, 94322506, 94322532, 94322604, 94322641, 94322670, 94322706)/*!*/;
# at 25077342
#100111 20:11:39 server id 115000 end_log_pos 863937261 Xid = 1225244590
COMMIT/*!*/;
From the log above , You can see binlog And realy-log The content is the same , Except for the beginning at Offset at position . Because the offset is always relative to the file itself , The main database is relative to binlog In itself , From the library relative to relay-log In itself . You can also see that , At every query After statement , There is one. Xid Of event, Commit the transaction , It also shows that in mysql Is automatically submitted , After each statement is executed , The system automatically submits . So in row based replication , You may see multiple binlog Statements correspond only once commit, Naturally, this is a row based replication .
And a little bit more , It is the corresponding location of the master library and the slave Library event The size is the same , For example, above :
25077342-25077069( From the library event size ) = 863937234-863936961( On the main warehouse event size )
otherwise , Description from the Library relay-log lost , It is possible that the operating system cache is lost , It could be mysql abnormal crash Lead to relay-log buffer Data loss in . Then you need to reset the master-slave synchronization .
边栏推荐
- opencv+dlib实现给蒙娜丽莎“配”眼镜
- Target detection - pytorch uses mobilenet series (V1, V2, V3) to build yolov4 target detection platform
- Charging interface docking tutorial of enterprise and micro service provider platform
- Deep anatomy of C language -- C language keywords
- UML圖記憶技巧
- ROS compilation calls the third-party dynamic library (xxx.so)
- ESP8266-RTOS物联网开发
- Shift Operators
- LeetCode:236. 二叉树的最近公共祖先
- Tcp/ip protocol
猜你喜欢

优秀的软件测试人员,都具备这些能力
![[OC]-<UI入门>--常用控件-UIButton](/img/4d/f5a62671068b26ef43f1101981c7bb.png)
[OC]-<UI入门>--常用控件-UIButton

Deep analysis of C language data storage in memory

Promise 在uniapp的简单使用

Cesium draw points, lines, and faces

Mongodb installation and basic operation

Target detection - pytorch uses mobilenet series (V1, V2, V3) to build yolov4 target detection platform

目标检测——Pytorch 利用mobilenet系列(v1,v2,v3)搭建yolov4目标检测平台
![[embedded] print log using JLINK RTT](/img/22/c37f6e0f3fb76bab48a9a5a3bb3fe5.png)
[embedded] print log using JLINK RTT

swagger设置字段required必填
随机推荐
LeetCode:236. The nearest common ancestor of binary tree
力扣每日一题(二)
Mongodb installation and basic operation
704 binary search
Sublime text using ctrl+b to run another program without closing other runs
Revit 二次开发 HOF 方式调用transaction
【嵌入式】Cortex M4F DSP库
The harm of game unpacking and the importance of resource encryption
【嵌入式】使用JLINK RTT打印log
R language ggplot2 visualization: place the title of the visualization image in the upper left corner of the image (customize Title position in top left of ggplot2 graph)
Tcp/ip protocol
TCP/IP协议
[MySQL] limit implements paging
R language ggplot2 visualization, custom ggplot2 visualization image legend background color of legend
JVM quick start
Leetcode: Sword Finger offer 42. Somme maximale des sous - tableaux consécutifs
自动化测试框架有什么作用?上海专业第三方软件测试公司安利
LeetCode:221. 最大正方形
广州推进儿童友好城市建设,将探索学校周边200米设安全区域
优秀的软件测试人员,都具备这些能力