In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1. Introduction
Binlog records database changes in the form of events. You can view events by executing the show binlog events in "binlog file" command
Mysql > show binlog events in "mysql-bin.000002" +-+-+ | Log_name | Pos | Event_type | Server_id | End_log_pos | Info | +-+- -- + | mysql-bin.000002 | 4 | Format_desc | 11 | 120 | Server ver: 5.6.26-debug-log Binlog ver: 4 | mysql-bin.000002 | Query | 11 | 191 | BEGIN | | mysql-bin.000002 | 191 | Table_map | 11 | 236 | table_id: 70 (yzs.t1) | | mysql-bin.000002 | 236 | Write_rows | 11 | | table_id: 70 flags: STMT_END_F | | mysql-bin.000002 | 280 | Xid | 11 | 311 | COMMIT / * xid=9 * / | +-| -+-+ 5 rows in set (0.00 sec) mysql > show binlog events in "mysql-bin.000001" +-+-+ | Log_name | Pos | Event_type | Server_id | End_log_pos | Info | +-+- -- + | mysql-bin.000001 | 4 | Format_desc | 11 | 120 | Server ver: 5.6.26-debug-log Binlog ver: 4 | mysql-bin.000001 | 120 | Query | 11 | 197 | BEGIN | | mysql-bin.000001 | 197 | Query | 11 | 294 | use `yzs` Insert into T1 select 2 | | mysql-bin.000001 | 294 | Xid | 11 | 325 | COMMIT / * xid=9 * / | | mysql-bin.000001 | 325 | Stop | 11 | 348 | | +- -- +-+ 5 rows in set (0.00 sec)
2. Binlog event format and type
It is divided into two parts, event header and event body. Event headers include:
Timestamp: the execution time for the start of the event. The fixed 4-byte display is the number of seconds since the new era (epoch time).
Event type: indicates the type of event
Server-id: server ID of the server
Event size: the length of the event
Next-log pos: fix the start position of the next 4-byte event
Flag: fixed 2-byte event flags
# define LOG_EVENT_BINLOG_IN_USE_F 0x1 this flags indicates whether binlog is turned off correctly
.. For other tags, please see the source code log_event.h
Event body: contains different information depending on the type of event.
Binlog event type:
Only the more important event types are selected for parsing. The next section parses each event type in detail.
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.