MySQL master has a table Products
that has triggers on update
and delete
. Deleted/Updated records are stored in ProductsUpdatedDeleted
tab.
When a record is deleted, the operation is replicated to the slave server. The issue is that slave also executes the trigger thus adding a record in its ProductsUpdatedDeleted
table. Then a duplicate record in ProductsUpdatedDeleted
received from the master server through replication.
What is the best way to stop the slave to execute triggers? I can comment trigger code in the slave but I would prefer both servers in the same state to quick failover.
Best Answer
Basically, there are two methods
METHOD #1
Use row-based replication. It says so in Paragraphs 1-3 of "Replication and Triggers"
METHOD #2
Drop all the triggers on the Slave. No trigger present, no trigger to execute.
Do not do both method. Just select one method.