Get the App
SLTechnology News&Howtos  ›  Database  › 

Fix mysql slave replication 1032 error

Shulou Source: shulou.com Published: 2022-06-01 07:19:08 09月17日 Update

There is a 1032 error in a slave library. What is that 1032 error? let's take a look at it.

[root@BLAVDP021 ~] # perror 1032MySQL error code 1032 (ER_KEY_NOT_FOUND): Can't find record in'%-.19s'

To put it simply, the corresponding record cannot be found from the library, and there is relevant output in show slave status\ G;. Let's take a look at:

Last_Errno: 1032Last_Error: Could not execute Update_rows event on table lenovoweixin.wx_app_order_code; Can't find record in 'wx_app_order_code', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000129, end_log_pos 4448749

As you can see from the above, executing the update statement copied from master in slave causes the SQL thread to report an error and stop the application because the slave cannot find the data. In other words, the error is caused by the data inconsistency on master and slave.

In this case, it is common to find the error, then modify the data on the slave, and then start slave to continue the application.

The wrong statement is not explicitly given in show slave status, so you need to analyze the binary log on the main library to see which statement it is.

Mysqlbinlog-- no-defaults-- base64-output=decode-rows-v-v / data/mysql/mysql_data/mysql-bin.000129 | grep-A 200 '4448749' > syk.txtvim syk.txtUPDATE `lenovoweixin`.`wx _ app_order_ code `where @ 1 "1607124 @ 2" 67516889 @ 3 "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=gQFe8TwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAyRThoN2gzSU1hamUxczJmTzFwMVYAAgSClGlZAwSAOgkA' @ 4" 201707144100080009'@ 5=NULL @ 6 "0 @ 7" 2017-07-15 12:05:22 @ 8 "2017-07-15 12:05: 22 @ 9=NULLSET @ 1 "1607124 @ 2" 67516889 @ 3 "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=gQFe8TwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAyRThoN2gzSU1hamUxczJmTzFwMVYAAgSClGlZAwSAOgkA' @ 4"201707144100080009'@ 5"LHCTjusway" hiinGjHg2Qog1Cisaccessible Pgw' @ 6 "7" 1 @ 7 "2017-07-15 12:05:22 12:05:22 @ 8" 2017-07-15 12:05:22 @ 9='fd9d079f-6323-473bmur8f4aracd37273e2ac5c'

Then query whether there is this record in the slave library, but not in the slave library, so we need to manually create this record on the slave library as follows:

Insert into wx_app_order_code (id,scene_id,code_url,orderid,flag,create_time,update_time) values (1607124 https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=gQFe8TwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAyRThoN2gzSU1hamUxczJmTzFwMVYAAgSClGlZAwSAOgkA','201707144100080009',0,'2017-07-15 67516889 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=gQFe8TwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAyRThoN2gzSU1hamUxczJmTzFwMVYAAgSClGlZAwSAOgkA','201707144100080009',0,'2017-07-15 12 purse 05purr 22')

Tags: Errors data statements applications queries consistency that is at the same time situations manual threading analysis output Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux MariaDB Huawei NVidia Redmi