博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
从show slave status 中1062错误提示信息找到binlog的SQL
阅读量:6249 次
发布时间:2019-06-22

本文共 3824 字,大约阅读时间需要 12 分钟。

mysql> show slave status\G

*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.190.27
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: restoredb-bin.000013
Read_Master_Log_Pos: 2637
Relay_Log_File: restoredb2-relay-bin.000010
Relay_Log_Pos: 1059
Relay_Master_Log_File: restoredb-bin.000013
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 1062
Last_Error: Could not execute Write_rows event on table liangdb.t_test_02; Duplicate entry '2' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log restoredb-bin.000013, end_log_pos 2606
Skip_Counter: 0
Exec_Master_Log_Pos: 2362
Relay_Log_Space: 1991
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 1062
Last_SQL_Error: Could not execute Write_rows event on table liangdb.t_test_02; Duplicate entry '2' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log restoredb-bin.000013, end_log_pos 2606
Replicate_Ignore_Server_Ids:
Master_Server_Id: 62
Master_UUID: 85f64e00-7a86-11e8-92cd-ee2079684cfe
Master_Info_File: /data/mysql/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State:
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp: 180724 16:46:36
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)

注意上面有三个信息是我们需要的:
Exec_Master_Log_Pos: 2362
master log restoredb-bin.000013
end_log_pos 2606

[root@restoredb mysql]# mysqlbinlog --base64-output="decode-rows" -v --start-position=2362 --stop-position=2606 restoredb-bin.000013 >liangguojun.log

 

[root@restoredb mysql]# cat liangguojun.log

/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 2362
#180724 16:46:46 server id 62 end_log_pos 2427 CRC32 0xe4e76605 Anonymous_GTID last_committed=sequence_number=7 rbr_only=yes
/*!50718 SET TRANSACTION ISOLATION LEVEL READ COMMITTED*//*!*/;
SET @@SESSION.GTID_NEXT= 'ANONYMOUS'/*!*/;
# at 2427
#180724 16:46:46 server id 62 end_log_pos 2502 CRC32 0xfe5c8054 Query thread_id=1261 exec_time=0 error_code=0
SET TIMESTAMP=1532422006/*!*/;
SET @@session.pseudo_thread_id=1261/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=268435456/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8 *//*!*/;
SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=33/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
# at 2502
#180724 16:46:46 server id 62 end_log_pos 2560 CRC32 0x63793851 Table_map: `liangdb`.`t_test_02` mapped to number 416
# at 2560
#180724 16:46:46 server id 62 end_log_pos 2606 CRC32 0xd4c25867 Write_rows: table id 416 flags: STMT_END_F
### INSERT INTO `liangdb`.`t_test_02`
### SET
### @1=2
### @2='test'
ROLLBACK /* added by mysqlbinlog */ /*!*/;
SET @@SESSION.GTID_NEXT= 'AUTOMATIC' /* added by mysqlbinlog */ /*!*/;
DELIMITER ;
# End of log file
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;

 

转载于:https://www.cnblogs.com/liang545621/p/9361398.html

你可能感兴趣的文章
curl
查看>>
查看本机密钥 以及服务器授权密钥 免密码登录
查看>>
Docker中如何删除image(镜像)
查看>>
泛型初始化
查看>>
pandas.read_csv参数详解
查看>>
oracle软件安装完毕之后,如何创建数据库
查看>>
『MXNet』第三弹_Gluon模型参数
查看>>
ASP.NET MVC 学习笔记-7.自定义配置信息 ASP.NET MVC 学习笔记-6.异步控制器 ASP.NET MVC 学习笔记-5.Controller与View的数据传递 ASP...
查看>>
Configuring Apache Kafka for Performance and Resource Management
查看>>
excel 截取单元格部分内容(从指定位置截取)
查看>>
Email-ext plugin
查看>>
绝对干货,教你4分钟插入1000万条数据到mysql数据库表,快快进来
查看>>
文件系统
查看>>
Android模拟器Genymotion安装apk
查看>>
chrome使用技巧(看了定不让你失望)
查看>>
数据字典
查看>>
Laravel Model 的 fillable (白名单)与 guarded (黑名单)
查看>>
idea激活
查看>>
Presto 性能优化点
查看>>
Key Lookup开销过大导致聚集索引扫描
查看>>