5

We would like to have a setup where a slave has triggers that are not present on the master for the purpose of updating some summary tables or run a specific udfs.sys

If one uses statement-based replication, they can just create the required triggers on the slave. The slave will run the statements from the binary log, which will cause the triggers to be invoked. With (the suggested) row-based, quote:

If under row-based replication the slave applied the triggers as well as the row changes caused by them, the changes would in effect be applied twice on the slave, leading to different data on the master and the slave.

https://dev.mysql.com/doc/refman/5.6/en/replication-features-triggers.html

Is there a way to run triggers on slave only with row-based replication, similar to what mariaDB have?

1 Answer 1

0

Perhaps instead, you require a Stored Procedure on your slave that you can run from a cron job mysql -e "call sp_udfs" to do the processing across the tables to alter that data. Events disable by default in a slave You could do a lot of work with that approach. This way you can control its behaviour much better than triggers. Other benefit, you can run any form of replication you wish, row, statement or mixed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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