zoukankan      html  css  js  c++  java
  • mysqlbinlog中解释事件hexdump

    在binlog文件中有时候打印出来的标准时间并不足以确定一个问题,有时候会出现一个一些特殊的数字代表,无法具体理解其具体数字细节代表的意义;为处理类似的情况,可以通过使用--hexdump来打印出相关的事件的详情;

    以下是案例如:

    [root@Slave02 data]# mysqlbinlog --hexdump  /usr/local/mysql/data/mysql-bin.000011
    /*!40019 SET @@session.max_insert_delayed_threads=0*/;
    /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
    DELIMITER /*!*/;
    # at 4
    #130401  9:38:04 server id 11  end_log_pos 107 
    # Position  Timestamp   Type   Master ID        Size      Master Pos    Flags 
    # 00000004 fc e4 58 51   0f   0b 00 00 00   67 00 00 00   6b 00 00 00   01 00
    # 00000017 04 00 35 2e 35 2e 31 33  2d 6c 6f 67 00 00 00 00 |..5.5.13.log....|
    # 00000027 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
    # 00000037 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
    # 00000047 00 00 00 00 fc e4 58 51  13 38 0d 00 08 00 12 00 |......XQ.8......|
    # 00000057 04 04 04 04 12 00 00 54  00 04 1a 08 00 00 00 08 |.......T........|
    # 00000067 08 08 02 00                                      |....|
    #       Start: binlog v 4, server v 5.5.13-log created 130401  9:38:04 at startup
    # Warning: this binlog was not closed properly. Most probably mysqld crashed writing it.
    ROLLBACK/*!*/;
    DELIMITER ;
    # End of log file
    ROLLBACK /* added by mysqlbinlog */;
    /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
    [root@Slave02 data]# mysqlbinlog --hexdump  /usr/local/mysql/data/mysql-bin.0000
    12
    /*!40019 SET @@session.max_insert_delayed_threads=0*/;
    /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
    DELIMITER /*!*/;
    # at 4
    #130402  9:28:54 server id 11  end_log_pos 107 
    # Position  Timestamp   Type   Master ID        Size      Master Pos    Flags 
    # 00000004 56 34 5a 51   0f   0b 00 00 00   67 00 00 00   6b 00 00 00   01 00
    # 00000017 04 00 35 2e 35 2e 31 33  2d 6c 6f 67 00 00 00 00 |..5.5.13.log....|
    # 00000027 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
    # 00000037 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
    # 00000047 00 00 00 00 56 34 5a 51  13 38 0d 00 08 00 12 00 |....V4ZQ.8......|
    # 00000057 04 04 04 04 12 00 00 54  00 04 1a 08 00 00 00 08 |.......T........|
    # 00000067 08 08 02 00                                      |....|
    #       Start: binlog v 4, server v 5.5.13-log created 130402  9:28:54 at startup
    # Warning: this binlog was not closed properly. Most probably mysqld crashed writing it.
    ROLLBACK/*!*/;
    # at 107
    #130402 15:45:51 server id 11  end_log_pos 367 
    # Position  Timestamp   Type   Master ID        Size      Master Pos    Flags 
    # 0000006b af 8c 5a 51   02   0b 00 00 00   04 01 00 00   6f 01 00 00   00 00
    # 0000007e 01 00 00 00 00 00 00 00  04 00 00 1a 00 00 00 00 |................|
    # 0000008e 00 00 01 00 00 00 00 00  00 00 00 06 03 73 74 64 |.............std|
    # 0000009e 04 21 00 21 00 21 00 74  65 73 74 00 63 72 65 61 |.......test.crea|
    # 000000ae 74 65 20 74 61 62 6c 65  20 69 74 65 6d 73 28 0a |te.table.items..|
    # 000000be 69 64 20 69 6e 74 20 6e  6f 74 20 6e 75 6c 6c 20 |id.int.not.null.|
    # 000000ce 61 75 74 6f 5f 69 6e 63  72 65 6d 65 6e 74 20 70 |auto.increment.p|
    # 000000de 72 69 6d 61 72 79 20 6b  65 79 2c 0a 73 68 6f 72 |rimary.key..shor|
    # 000000ee 74 5f 64 65 73 63 72 69  70 74 69 6f 6e 20 76 61 |t.description.va|
    # 000000fe 72 63 68 61 72 28 32 35  35 29 2c 0a 64 65 73 63 |rchar.255...desc|
    # 0000010e 72 69 70 74 69 6f 6e 20  74 65 78 74 2c 0a 65 78 |ription.text..ex|
    # 0000011e 61 6d 70 6c 65 20 74 65  78 74 2c 0a 65 78 70 6c |ample.text..expl|
    # 0000012e 61 6e 61 74 69 6f 6e 20  74 65 78 74 2c 0a 61 64 |anation.text..ad|
    # 0000013e 64 69 74 69 6f 6e 61 6c  20 74 65 78 74 29 20 65 |ditional.text..e|
    # 0000014e 6e 67 69 6e 65 3d 69 6e  6e 6f 64 62 20 64 65 66 |ngine.innodb.def|
    # 0000015e 61 75 6c 74 20 63 68 61  72 73 65 74 3d 75 74 66 |ault.charset.utf|
    # 0000016e 38                                               |8|
    #       Query   thread_id=1     exec_time=0     error_code=0
    use test/*!*/;
    SET TIMESTAMP=1364888751/*!*/;
    SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1/*!*/;
    SET @@session.sql_mode=0/*!*/;
    /*!\C utf8 *//*!*/;
    SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=33/*!*/;
    create table items(
    id int not null auto_increment primary key,
    short_description varchar(255),
    description text,
    example text,
    explanation text,
    additional text) engine=innodb default charset=utf8
    /*!*/;
    # at 367
    #130402 16:57:39 server id 11  end_log_pos 435 
    # Position  Timestamp   Type   Master ID        Size      Master Pos    Flags 
    # 0000016f 83 9d 5a 51   02   0b 00 00 00   44 00 00 00   b3 01 00 00   08 00
    # 00000182 01 00 00 00 00 00 00 00  04 00 00 1a 00 00 00 00 |................|
    # 00000192 00 00 01 00 00 00 00 00  00 00 00 06 03 73 74 64 |.............std|
    # 000001a2 04 21 00 21 00 21 00 74  65 73 74 00 42 45 47 49 |.......test.BEGI|
    # 000001b2 4e                                               |N|
    #       Query   thread_id=1     exec_time=0     error_code=0
    SET TIMESTAMP=1364893059/*!*/;
    BEGIN
    /*!*/;
    # at 435
    #130402 16:57:39 server id 11  end_log_pos 528 
    # Position  Timestamp   Type   Master ID        Size      Master Pos    Flags 
    # 000001b3 83 9d 5a 51   02   0b 00 00 00   5d 00 00 00   10 02 00 00   00 00
    # 000001c6 01 00 00 00 00 00 00 00  04 00 00 1a 00 00 00 00 |................|
    # 000001d6 00 00 01 00 00 00 00 00  00 00 00 06 03 73 74 64 |.............std|
    # 000001e6 04 21 00 21 00 21 00 74  65 73 74 00 64 65 6c 65 |.......test.dele|
    # 000001f6 74 65 20 66 72 6f 6d 20  20 74 31 2c 74 32 20 75 |te.from..t1.t2.u|
    # 00000206 73 69 6e 67 20 74 31 2c  74 32                   |sing.t1.t2|
    #       Query   thread_id=1     exec_time=0     error_code=0
    SET TIMESTAMP=1364893059/*!*/;
    delete from  t1,t2 using t1,t2
    /*!*/;
    # at 528
    #130402 16:57:39 server id 11  end_log_pos 597 
    # Position  Timestamp   Type   Master ID        Size      Master Pos    Flags 
    # 00000210 83 9d 5a 51   02   0b 00 00 00   45 00 00 00   55 02 00 00   08 00
    # 00000223 01 00 00 00 00 00 00 00  04 00 00 1a 00 00 00 00 |................|
    # 00000233 00 00 01 00 00 00 00 00  00 00 00 06 03 73 74 64 |.............std|
    # 00000243 04 21 00 21 00 21 00 74  65 73 74 00 43 4f 4d 4d |.......test.COMM|
    # 00000253 49 54                                            |IT|
    #       Query   thread_id=1     exec_time=0     error_code=0
    SET TIMESTAMP=1364893059/*!*/;
    COMMIT
    /*!*/;
    DELIMITER ;
    # End of log file
    ROLLBACK /* added by mysqlbinlog */;
    /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
    [root@Slave02 data]# 
    

    可以看到一些信息和事件的特定的信息被分成两行,而他们被合并在正常的输出中显示出来

  • 相关阅读:
    synchronized底层实现学习
    [Alink漫谈之三] AllReduce通信模型
    Alink漫谈(二) : 从源码看机器学习平台Alink设计和架构
    Alink漫谈(一) : 从KMeans算法实现不同看Alink设计思想
    [源码分析]从"UDF不应有状态" 切入来剖析Flink SQL代码生成 (修订版)
    从"UDF不应有状态" 切入来剖析Flink SQL代码生成
    [源码分析] 带你梳理 Flink SQL / Table API内部执行流程
    [白话解析] 通俗解析集成学习之bagging,boosting & 随机森林
    [源码分析] 从FlatMap用法到Flink的内部实现
    Ceph 14.2.5-K8S 使用Ceph存储实战 -- <6>
  • 原文地址:https://www.cnblogs.com/xinyuyuanm/p/3022842.html
Copyright © 2011-2022 走看看