1

Hi I have a master Mysql server from where i am replicating other 2 slaves. The issue is one of the slave stops with an error frequently. The error message is below.

Error 'Duplicate entry '1993996' for key 1' on query. Default database: 'ooxadmin_ooxmonitor'.
Query: 'INSERT INTO users_history SET
user_id = '22',
user_last_access = NOW(),
user_status = 'Online',
user_session = 'aa78ee40a941aea26a0e0c10c714b5a9',
user_ip = '94.200.71.50''

I have tried 'SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1' and starting the slave again, then it starts replicating and then stops after a few minutes/hours. I want to know what causes this issue and how to setup replication without this error. My mysql version is 5.0.9.

NickW
  • 10,271

1 Answers1

1

If you skip the error that means it will continue replicating, but the reason why it broke is not solved. Install percona-toolkit, run pt-table-checksum to find the differences, and run pt-table-sync to resync the tables. But I guess the most easy way to solve this to discard a slave, and restore it from a recent backup of master, and set replication from there.

Look here to read more about checksumming: http://blog.balazspocze.me/2014/12/03/a-few-words-about-database-checksumming/

banyek
  • 399