7
  • Master version: mysql-server-5.5.14-1.el5.remi
  • Slave version: Percona-XtraDB-Cluster-server-5.5.24-23.6.340
  • Binlog format: ROW based

I'm using PRM to setup HA for MySQL.

Sometime, MySQL slave stopped with some errors:

Error executing row event: 'Table 'reportingdb.tvc_ads_tag_date' doesn't exist'

[Warning] Slave SQL: Could not execute Update_rows event on table reportingdb.7k_banner_channel_tmp; Can't find record in '7k_banner_channel_tmp', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000854, end_log_pos 859094925, Error_code: 1032

120828 0:36:13 [Warning] Slave SQL: Could not execute Write_rows event on table reportingdb.7k_bookings_ver; Duplicate entry '1518' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log mysql-bin.001022, end_log_pos 509479, Error_code: 1062

Error 'Error in list of partitions to DROP' on query. Default database: 'reportingdb'. Query: 'ALTER TABLE v3_ban_date_cpm7k DROP PARTITION pcurrent_201298'

and the mysql.sock is missing but the MySQL processes still exist. Pacemaker cannot restart due to the below errors:

InnoDB: Unable to lock ./ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.

I have to login via TCP (-h 127.0.0.1) and stop MySQL first, then let corosync start MySQL again.

In summary, the question is:

  1. How do I solve the above slave errors and prevent them from happening in the future?
  2. Why is the mysql.sock missing? How do I make the Pacemaker better handle this situation?
Hannah Vernon
  • 70,928
  • 22
  • 177
  • 323
quanta
  • 1,006
  • 9
  • 22
  • 36

2 Answers2

11

It's better not to skip by hundreds. Just loop one-by-one:

until mysql -e "show slave status\G;" | grep -i "Slave_SQL_Running: Yes";do
  mysql -e "stop slave; SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; start slave;";
  sleep 1;
done
Andriy M
  • 23,261
  • 6
  • 60
  • 103
Zaur
  • 211
  • 2
  • 3
3

just stop the slave using

mysql> stop slave;

Then set the global variable sql_slave_skip_counter to 1, for example:

mysql> set global sql_slave_skip_counter=1;

Then start the slave:

mysql> start slave;

Then check if the slave is working or not:

mysql> show slave status \G;

If the error is still there, set a bigger value in sql_slave_skip_counter like:

mysql> set global sql_slave_skip_counter=1000;

Again, check the status of the slave.

If you find the skip_sql value is non zero in the slave status then stop the slave again and do:

mysql> set global sql_slave_skip_counter=0;
mysql> start slave;
Hannah Vernon
  • 70,928
  • 22
  • 177
  • 323
vijay
  • 41
  • 1