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.

  • 1
    I see you're replicating a radius db, what is the key field that's set.. maybe you could post a show create table ? – NickW May 23 '13 at 9:16
  • what error you are getting in Mysql Logs? Please post some here. – Abhishek Anand Amralkar May 23 '13 at 10:14
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/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.