By using the following command the replication connection works, but it will break after 1-2 hrs:
mysql> STOP SLAVE;
mysql> SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
mysql> START SLAVE;
mysql> SHOW SLAVE STATUS \G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 10.5.61.251
Master_User: repusr
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: master-bin.000006
Read_Master_Log_Pos: 30468727
Relay_Log_File: mysql-relay-bin.000002
Relay_Log_Pos: 28727392
Relay_Master_Log_File: master-bin.000006
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 1062
Last_Error: Error 'Duplicate entry 'fetch_task::mayo' for key 'PRIMARY'' on query. Default database: 'oladb'. Query: 'INSERT INTO cache_update (cid, created) VALUES ('fetch_task::mayo', '1487309543')'
Skip_Counter: 0
Exec_Master_Log_Pos: 28753090
Relay_Log_Space: 30443185
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 1062
Last_SQL_Error: Error 'Duplicate entry 'fetch_task::mayo' for key 'PRIMARY'' on query. Default database: 'ola'. Query: 'INSERT INTO cache_update (cid, created) VALUES ('fetch_task::mayo', '1487309543')'
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
1 row in set (0.00 sec)
Now after 1hrs it break again and shows
mysql> SHOW SLAVE STATUS \G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 10.5.61.251
Master_User: repusr
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: master-bin.000006
Read_Master_Log_Pos: 67365133
Relay_Log_File: mysql-relay-bin.000005
Relay_Log_Pos: 29089448
Relay_Master_Log_File: master-bin.000006
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 1452
Last_Error: Error 'Cannot add or update a child row: a foreign key constraint fails (`adsyjportal`.`ads_files_notes`, CONSTRAINT `FK_A018C6425E7E37C8` FOREIGN KEY (`ads_files_id`) REFERENCES `ads_files` (`id`))' on query. Default database: 'adsyjportal'. Query: 'INSERT INTO ads_files_notes (gu_id, sender_employee_name, note, note_time, ip_address, is_approved, is_seen, is_note_send, file_status, is_viewed_by_receiver, hits, ads_files_id, sender_seat_id, receiver_seat_id, note_sending_to, sender_employee_id, created_by_user_id) VALUES ('f225fd926b84aee4a4bc2303fa1896d7', 'Srerajelatha L, Section Officer', NULL, '2017-02-17 12:06:34', '10.10.40.517', 0, 0, 0, 0, 0, 0, 1101, 6, 6, 7, 33, 143)'
Skip_Counter: 0
Exec_Master_Log_Pos: 66254800
Relay_Log_Space: 30199937
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 1452
Last_SQL_Error: Error 'Cannot add or update a child row: a foreign key constraint fails (`adsyjportal`.`ads_files_notes`, CONSTRAINT `FK_A018C6425E7E37C8` FOREIGN KEY (`ads_files_id`) REFERENCES `ads_files` (`id`))' on query. Default database: 'adsyjportal'. Query: 'INSERT INTO ads_files_notes (gu_id, sender_employee_name, note, note_time, ip_address, is_approved, is_seen, is_note_send, file_status, is_viewed_by_receiver, hits, ads_files_id, sender_seat_id, receiver_seat_id, note_sending_to, sender_employee_id, created_by_user_id) VALUES ('f225fd926b84aee4a4bc2303fa1896d7', 'Sreragelatha L, Section Officer', NULL, '2017-02-17 12:06:34', '10.10.40.517', 0, 0, 0, 0, 0, 0, 1101, 6, 6, 7, 33, 143)'
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
1 row in set (0.00 sec)
How can I fix this?