Hi, I have mariadb master-master replication. As far as I understand events should be triggered on one node only. Can events be automatically turned on on a second master if the one running events goes down for any reason and turn events off on one of them if the master is up again?
‘Events’ in MySQL are not coordinated between servers via replication. Events on mysql1 will execute independently from events on mysql2.
You can turn the event scheduler on/off at runtime using
SET GLOBAL event_scheduler=[ON|OFF]
You might be able to do something where event scheduler runs on both, runs an event every X minutes which checks the value of some metadata row. On mysql1, any events should update this table. On mysql2, if there have been no updates in the past X minutes, run events on mysql2. But there is no safety here, no guarantees of any kind; completely possible for same event to run at same time on both mysqls.
I guess it will be same for Galera.
Yes, it will be the same for PXC (ie: Galera). The event scheduler is 100% local and no state/status of the scheduler is part of Galera protocol nor async replication.