Slave replication stops with Last_SQL_Errno: 1032

27,326

Solution 1

You can locate the sql clause code like /usr/bin/mysqlbinlog -v --start-position=142743807 --stop-position=147399325 /data/mysql/data/master-bin.000010 > temp.log

Then compare slave and master database difference according to temp.log on specific pos. Then update slave database.

Then skip that line with mysql -e "stop slave; SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; start slave;";

Solution 2

For people who have this as a one off error, you can try skipping the item:

SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;

START SLAVE;

Solution 3

You can set the following in your slave's my.cnf: [mysqld] slave-skip-errors=1032

But as the documentation says: Do not use this option unless you fully understand why you are getting errors. One of the possible reason for this error could be due to “Slave_IO_Running: Yes” but “Slave_SQL_Running: No” that means your Slave IO process is running and retrieving data from Master but couldn’t execute due to Slave_SQL_Running process is stopped. A monitoring tool like Monyog can be used to proactively monitor the replication and alert you to the error or a lag or disconnection between the Master and Slave servers.

Share:
27,326

Related videos on Youtube

adminz
Author by

adminz

Updated on September 18, 2022

Comments

  • adminz
    adminz almost 2 years

    I have added an extra Slave server to an existing MySQL Replication. The Master server and the old Slave server are working fine without any issue, but the newly added server is stoping with the following error:

    Last_SQL_Errno: 1032
    Last_SQL_Error: Could not execute Update_rows event on table xxx.email_events; Can't find record in 'email_events', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysqld-bin.000410, end_log_pos 368808733

    It will be fine for some hours after repairing.

    Questions

    • Can we permanently skip Last_SQL_Errno: 1032?
    • Is there any issue with skipping this error?
  • Eugene van der Merwe
    Eugene van der Merwe over 4 years
    For some reason this doesn't seem to work for me in spite of adding that to the slave. Which version of MySQL are you using? The problem I have on my system is that doing this solves the immediate problem: mysql -e "stop slave; SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; start slave;"; However, the new errors always appear.
  • Dusty Vargas
    Dusty Vargas over 4 years
    This answer doesn't make sense to me. "that means your Slave IO process is running and retrieving data from Master but couldn’t execute due to Slave_SQL_Running process is stopped" in particular because the Slave IO thread doesn't execute anything on the slave. That is the job of the SQL thread. The IO thread just retrieves events from the master (as I understand).