When I check the slave status, I just see one error. So there is just 1 error. Is there a way to check for more duplicates?
[root~]# mysql -e 'show slave status\G'
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Last_Error: Error 'Duplicate entry 'a320457cde-184.108.40.206' for key 'countername'' on query. Default database: 'ssg'. Query: 'insert into counters (countername, goid) values ('a320457cde-220.127.116.11', x'1962874862065718D8BF365623EA6DED')'
Last_SQL_Error: Error 'Duplicate entry 'a320457cde-18.104.22.168' for key 'countername'' on query. Default database: 'ssg'. Query: 'insert into counters (countername, goid) values ('a320457cde-22.214.171.124', x'1962874862065718D8BF365623EA6DED')'
The replication was broken due to duplicate entries in 'counter' table or relay logs
Advised the user to carry out the following steps which has resolved the customer's problem.
1. check there is no duplicates in the counter table.
>> select count(*), countername from counters group by countername having count(*) > 1
if there are duplicates, you may consider the deleting them from 'counters' table:
a. keep a backup copy of counter table :
CREATE TABLE IF NOT EXISTS counter_bk SELECT * FROM counter;
b.. remove the specific counter from the 'counter' table:
DELETE FROM counter WHERE countername = 'a320457cde-126.96.36.199'
2. clean up the bin logs and relay logs using the following KB article
3. Finally, reinitialize the replication.