If you find duplicate query in slave please follow the below steps to skip the query from slave.
Steps:
- Take the ID from show slave status\G
- Retrieved_Gtid_Set: 7d72f9b4-8577-11e2-a3d7-080027635ef5:1-5 (This is ID which you will find in show slave status which the slave was retrying)
- Executed_Gtid_Set: 7d72f9b4-8577-11e2-a3d7-080027635ef5:1-5 (This is ID which you will find in show slave status which slave need to execute afterwords)
- STOP SLAVE;
- SET GTID_NEXT=”7d72f9b4-8577-11e2-a3d7-080027635ef5:5″; (This is ID which you need to take and edit from show slave status\G (here you need to take the ID fromExecuted_Gtid_Set and just increase with one number at end e.g.7d72f9b4-8577-11e2-a3d7-080027635ef5:1-5 Edit new ID7d72f9b4-8577-11e2-a3d7-080027635ef5:6 you need to remove 1-5 and add 6 at end))
- BEGIN; COMMIT;
- SET GTID_NEXT=”AUTOMATIC”;
- START SLAVE; […]