Mysql – Slave stoping with Last_SQL_Errno: 1032

linuxmaster-slave-replicationMySQLmysql-5.5

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

I'm a newbie,

  • how can I resolve this issue?

  • Can we permanently skip Last_SQL_Errno: 1032?

  • Is there any issue with skipping this error?

Best Answer

The way I prefer to make another Slave (S2) is to clone an existing Slave (S1)

  1. Install the mysql on S2, but turn off mysql.
  2. STOP SLAVE on S1.
  3. Stop mysql on S1.
  4. Copy the entire mysql tree from S1 to S2.
  5. Copy my.cnf (or its include files) from S1 to S2, but be sure to change server_id.
  6. Start mysql on S1; START SLAVE.
  7. Start mysql on S2; START SLAVE.

Both S1 and S2 will then catch up on replication from the same point.

Apparently your creation of S2 failed in some way; I am recommending you start over rather than "fix" the inconsistent data.

If you would prefer to fix, then see Percona toolkit.

Related Question