Mysql – slave replication stopped working

MySQLreplication

This morning my slave stopped working..

Slave_IO_State: Waiting for master to send event
Slave_IO_Running: Yes
Slave_SQL_Running: No

Last_SQL_Error: Could not execute Update_rows event on table
dynaccount.account; Can't find record in 'account', Error_code: 1032;
handler error HA_ERR_KEY_NOT_FOUND; the event's master log
mysql-bin.000025, end_log_pos 802331975

Restoring slave

- Master
# mysqldump -u root -pxxx --single-transaction --hex-blob --routines --triggers --events --quick --add-drop-database --extended-insert --databases my_db | gzip > /root/dump.sql.gz
# scp -o 'StrictHostKeyChecking no' /root/dump.sql.gz root@remote.com:/root

- Slave
# mysql -u root_slave -pxxx -e "stop slave; reset master"

# pv /root/dump.sql.gz | gunzip | mysql -u root_slave -pxxx
# mysql -u root_slave -pxxx -e "start slave"
# mysql -u root_slave -pxxx -e "show slave status\G"

After restoring the slave I keep getting the same error?!

Best Answer

Add --master-data to the mysqldump. That way the change of slave position to where you did the mysqldump gets executed when you load it.

Related Question