重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
该格式描述事件时binlog version 4中为了取代之前版本的START_EVENT_3事件而引入的。是binlog文件的第一个事件,并在一个binlog文件中仅出现一次。具体定义:
binlog-version:binlog版本
MySQL-server version:服务器版本
create timestamp:指明binlog文件的创建时间。如果该binlog是由于切换产生,那么该字段是0
event header length:189
event type header lengths:记录所有事件的私有事件头的长度,event的个数定义5.6,5.7为40个,也就是40个字节
我们提供的服务有:成都做网站、成都网站建设、成都外贸网站建设、微信公众号开发、网站优化、网站认证、坊子ssl等。为成百上千企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的坊子网站制作公司
[mysql26@localhost data]$ hexdump -Cv mysql-bin.000002 > 2.txt
[mysql26@localhost data]$ vi 2.txt
00000000 fe 62 69 6e 46 c4 a4 5a 0f 0b 00 00 00 74 00 00 |.binF..Z.....t..|
00000010 00 78 00 00 00 01 00 04 00 35 2e 36 2e 32 36 2d |.x.......5.6.26-|
00000020 64 65 62 75 67 2d 6c 6f 67 00 00 00 00 00 00 00 |debug-log.......|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000040 00 00 00 00 00 00 00 00 00 00 00 46 c4 a4 5a 13 |...........F..Z.|
00000050 38 0d 00 08 00 12 00 04 04 04 04 12 00 00 5c 00 |8.............\.|
00000060 04 1a 08 00 00 00 08 08 08 02 00 00 00 0a 0a 0a |................|
00000070 19 19 00 01 c8 a1 c5 19 62 c4 a4 5a 02 0b 00 00 |........b..Z....|
00000080 00 47 00 00 00 bf 00 00 00 08 00 01 00 00 00 00 |.G..............|
00000090 00 00 00 03 00 00 1a 00 00 00 00 00 00 01 00 00 |................|
000000a0 00 40 00 00 00 00 06 03 73 74 64 04 21 00 21 00 |.@......std.!.!.|
000000b0 21 00 79 7a 73 00 42 45 47 49 4e 30 85 8c ba 62 |!.yzs.BEGIN0...b|
000000c0 c4 a4 5a 13 0b 00 00 00 2d 00 00 00 ec 00 00 00 |..Z.....-.......|
000000d0 00 00 46 00 00 00 00 00 01 00 03 79 7a 73 00 02 |..F........yzs..|
分析:
1、开头4个字节binlog magic number:fe 62 69 6e,即.bin
2、第一个binlog事件是FORMAT_DESCRIPTION_EVENT。
3、timestamp: 46 c4 a4 5a,即小端显示0x5aa4c446,十进制1520747590,
[mysql26@localhost data]$ date -d "@1520747590"
Sat Mar 10 21:53:10 PST 2018
binlog解析的时间是:#180310 21:53:10 server id 11 end_log_pos 120 CRC32 0x19c5a1c8 Start: binlog v 4, server v 5.6.26-debug-log created 180310 21:53:10 at startup
3、event type:0f,即15
5、server-id:0b 00 00 00,即小端显示0x00 00 00 0b,即为11
6、event size:74 00 00 00:0x 00 00 00 74,116。120-4(.bin)
7、next-log pos:78 00 00 00:0x00 00 00 78,120,下一个event的位置,相对文件头位置,和end_log_pos 120一致
8、flag:01 00;为0X0001那么会在MYSQLBINLOG输出中报一个警告说本binlog没有关闭
9、binlog version:04 00,小端显示及0X0004,和mysqlbinlog中的解析Start: binlog v 4一致
10、mysql server version:5.6.26-debug-log,剩下的字节0填充
00000010 35 2e 36 2e 32 36 2d |.x.......5.6.26-|
00000020 64 65 62 75 67 2d 6c 6f 67 00 00 00 00 00 00 00 |debug-log.......|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000040 00 00 00 00 00 00 00 00 00 00 00
11、create stamp:46 c4 a4 5a,和event头一样
12、event header length:13,即19字节
13、event header lengths:array[30]-[32]:0a 0a 0a,表示 WRITE_ROWS_EVENT = 30,UPDATE_ROWS_EVENT = 31, DELETE_ROWS_EVENT = 32的私有事件头长度
00000050 38 0d 00 08 00 12 00 04 04 04 04 12 00 00 5c 00 |8.............\.|
00000060 04 1a 08 00 00 00 08 08 08 02 00 00 00 0a 0a 0a |................|
00000070 19 19 00 01 c8 a1 c5 19
参考:http://blog.itpub.net/7728585/viewspace-2133189/