mysql 复制 1032_mysql slave复制1032错误解决方法
http://hi.baidu.com/dba_hui/item/a4b23a60ae1d6882c4d2497c
查看slave复制状态,发现SQL线程停止应用:mysql> show slave status \G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.9.61
Master_User: repl
Master_Port: 3312
Connect_Retry: 60
Master_Log_File: mysql-bin.000034
Read_Master_Log_Pos: 742553356
Relay_Log_File: relay-log.000004
Relay_Log_Pos: 41832895
Relay_Master_Log_File: mysql-bin.000034
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table: eoc.%,test.%,mysql.%
Replicate_Wild_Ignore_Table:
Last_Errno: 1032
Last_Error: Could not execute Delete_rows event on table eoc.eoc_course_rank; Can't find record in 'eoc_course_rank', Error_code: 1032; handler error HA_ERR_END_OF_FILE; the event's master log mysql-bin.000034, end_log_pos 684728241
Skip_Counter: 0
Exec_Master_Log_Pos: 684727611
Relay_Log_Space: 257830925
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: 1032
Last_SQL_Error: Could not execute Delete_rows event on table eoc.eoc_course_rank; Can't find record in 'eoc_course_rank', Error_code: 1032; handler error HA_ERR_END_OF_FILE; the event's master log mysql-bin.000034, end_log_pos 684728241
1 row in set (0.00 sec)
错误日志如下:
120719 1:01:07 [ERROR] Slave SQL: Could not execute Delete_rows event on table eoc.eoc_course_rank; Can't find record in 'eoc_course_rank', Error_code: 1032; handler error HA_ERR_END_OF_FILE; the event's master log mysql-bin.000034, end_log_pos 684728241, Error_code: 1032
120719 1:01:07 [Warning] Slave: Can't find record in 'eoc_course_rank' Error_code: 1032
120719 1:01:07 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'mysql-bin.000034' position 684727611
从上面的情况可以看出,在slave执行从master复制过来的delete语句因为slave找不到要删除的数据,导致SQL线程报错,停止应用。也就是说master和slave上数据不一致导致的该错误。
遇到这种情况,一般都是找出错误,然后修改slave上的数据,然后启动slave,继续应用。
比如上面,要删除的数据在slave上找不到,我们就想知道是删除哪条数据呢?但是show slave status中又没有明确给出错误的语句,因此需要分析binary log来查看是哪条语句。
binary log的格式是mixed,初步使用mysqlbinlog查看,发现该条语句是RBR,而不是SBR,因此需要使用--base64-output=decode-rows -v -v选项,如下:
使用binary log:
[root@awstats usr]# /usr/local/mysql5157_2/bin/mysqlbinlog --no-defaults --base64-output=decode-rows -v -v mysql-bin.000034 | grep -A 200 '684728241' > zhh.txt
或者
使用relay log:
[root@mysqldb var]# /usr/local/mysql51572/bin/mysqlbinlog --no-defaults --base64-output=decode-rows -v -v relay-log.000004 | grep -A 200 '684728241' > zhh.txt
查看文件,发现以下内容:
#120719 1:01:03 server id 1 end_log_pos 684728241 Delete_rows: table id 16854 flags: STMT_END_F
### DELETE FROM eoc.eoc_course_rank
### WHERE
### @1=2 /* TINYINT meta=0 nullable=0 is_null=0 */
### @2=392 /* SHORTINT meta=0 nullable=0 is_null=0 */
### @3=574 /* INT meta=0 nullable=0 is_null=0 */
### @4='xxx' /* VARSTRING(192) meta=192 nullable=0 is_null=0 */
### @5='yyy' /* VARSTRING(1500) meta=1500 nullable=1 is_null=0 */
### @6='20111202-2df9eef5c0e33cfd643927cb1bb048fa17a40dfa.jpg' /* VARSTRING(600) meta=600 nullable=1 is_null=0 */
### @7=3 /* INT meta=0 nullable=1 is_null=0 */
### @8=256 /* INT meta=0 nullable=1 is_null=0 */
# at 684728241
即出错误的语句为:
delete from eoc.eoc_course_rank
where
第一列等于2
第二列等于392
......
根据该表的主键在slave查询,发现where条件中有一个字段值不同,因此在slave上找不到要删除的数据。
mysql> use eoc;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> SELECT * FROM eoc_course_rank
-> WHERE course_id=574 \G;
*************************** 1. row ***************************
rank_type: 2
rank_id: 385
course_id: 574
course_name: xxx
detail_info: yyy
brief_image: 20111202-2df9eef5c0e33cfd643927cb1bb048fa17a40dfa.jpg
cp_id: 3
grade_id: 256
1 row in set (0.00 sec)
ERROR:
No query specified
mysql> UPDATE eoc_course_rank SET rank_id= 392 WHERE course_id=574;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
mysql> stop slave;
Query OK, 0 rows affected (0.00 sec)
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)
mysql> show slave status \G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.9.61
Master_User: repl
Master_Port: 3312
Connect_Retry: 60
Master_Log_File: mysql-bin.000034
Read_Master_Log_Pos: 746616004
Relay_Log_File: relay-log.000004
Relay_Log_Pos: 95495411
Relay_Master_Log_File: mysql-bin.000034
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table: eoc.%,test.%,mysql.%
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 738390127
Relay_Log_Space: 261893867
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: 4791
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
1 row in set (0.00 sec)
mysql> show slave status \G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.9.61
Master_User: repl
Master_Port: 3312
Connect_Retry: 60
Master_Log_File: mysql-bin.000034
Read_Master_Log_Pos: 747488636
Relay_Log_File: relay-log.000005
Relay_Log_Pos: 904068
Relay_Master_Log_File: mysql-bin.000034
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table: eoc.%,test.%,mysql.%
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 747488636
Relay_Log_Space: 104594214
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: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
1 row in set (0.00 sec)
上面说了,产生该错误的根本原因是主从数据不一致。为什么主从数据不一致呢?
从报错的时间点分析,发现该错误数据是一个event执行后产生的,查看该event,发现有存在结果集不确定的语句。修改该event的sql,再次执行该event调用的stored procedure,状态仍然为双YES。
另外有一点不明白:
my.cnf中设置的binary log是mixed格式:在未修改该sql之前,该行数据binary log记录的是RBR格式;修改后记录的是SBR格式。
mysql 复制 1032_mysql slave复制1032错误解决方法相关推荐
- mysql 增删改查时的错误解决方法大全
mysql 增删改查时的错误解决方法大全 信息1:Error: Access denied for user: 'linanma@localhost' (Using password: YES ...
- mysql 1236_Mysql主从同步Last_IO_Errno:1236错误解决方法
Mysql主从同步的Last_IO_Errno:1236错误是什么原因呢,我们要如何来解决这个问题呢?下面和小编一起来看看关于此问题的记录与解决办法. 从服务器错误代码: Last_IO_Errno: ...
- mysql hy000 2013_MySQL ERROR 2013 (HY000)错误解决方法
当通过 TCP/IP 连接 MySQL 远程主机时,出现 ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial ...
- navicat MySQL 导出数据时出现1577错误解决方法
问题描述: Navicat for MySQL导出任何一个数据库,都会提示:1577 – Cannot proceed because system tables used by Event Sche ...
- mysql报1292 Incorrect datetime value错误解决方法
mysql插入.修改datetime类型的字段,报 Incorrect datetime value 的错误,sql语句如下: UPDATE xxx set time='2023-02-28T09:3 ...
- mysql初始数据库出错_安装MySQL提示initialize database(初始化数据库)错误解决方法...
1.若原来电脑上安装过MySQL,需要将原来安装的软件彻底卸载干净再进行安装 (1)首先停止原MySQL服务 我的电脑--右击--管理--进入服务--找到MySQL--关闭此服务 (2)进入卸载程序控 ...
- mysql的Navicat连接显示1862错误解决方法
1.选择可视化连接时,始终连接不上,并不是用户名或密码错误,而是长期没用的密码过期 通过以下步骤操作: (1)进入mysql安装目录的bin目录下,执行>mysql -uroot -p 密码 即 ...
- apmserv mysql_APMServ MySQL 1577错误解决方法_MySQL
bitsCN.com APMServ MySQL 1577错误解决方法 Navicat导出任何一个数据库,都会提示:1577 – Cannot proceed because system table ...
- Navicat Premium链接MySQL时出现2059错误解决方法
下面这个是有关Navicat Premium链接MySQL时出现2059错误解决方法的教程(在看该教程之前mysql的配置已完成) 链接MySQL时出现2059错误该怎么解决呢? 提示:以下是本篇文章 ...
最新文章
- C语言函数集(二十一)
- 获取的官方例程后怎么开发_开发商败诉后拒不赔偿怎么办,房地产纠纷处理方式有哪些?...
- oracle数据库存储过程中NO_DATA_FOUND不起作用解决
- eclipse中在类saolei.Test 中找不到main方法
- 学习linux第二周作业
- Springboot01创建第一个程序
- Selenium与Cypress的比较
- Fetion2008 分析 Part1:准备工作
- JAVA上百实例源码以及开源项目
- (带手机版数据同步)高等院校学院学校类网站源码 政府单位学院学校网站织梦模板
- Java DAO、Service、web理解之DAO层
- 写给小白的区块链科普文
- 产品新创意,创意产品原型大公开,原来可以这样做!
- android启动页广告图,一张图搞定APP启动页广告
- fatal: ‘origin‘ does not appear to be a git repository
- Android搜索控件SearchView的用法
- CTypedPtrArray的引用
- AD入门学习—元件库的创建2
- 重磅!鼎捷软件参与编写制定的机械行业团体标准正式发布
- 《笨办法学Python》 总结
热门文章
- Python IDLE 如何设置清屏功能(清屏快捷键,亲测可用)
- 【闲得无聊】写个web版功德无量附代码+静态资源
- 2021年二级c语言软件下载,2021计算机二级宝典
- Python-with open() as f写入
- 求解数独的C++实现
- 品牌国际传播第一步:谁是最重要的人?| 直播活动预告
- 蓝桥杯(纯C)比赛--菜鸟级
- 有哪些在成都开了 20 年以上的味道不错的小饭馆
- 神经网络及其变种串联
- 三星S7edge从8.0降到6.0.1,只为流畅的飞一般的感觉_我是亲民_新浪博客