# Events on master-master replication

**URL:** <https://forums.percona.com/t/events-on-master-master-replication/12780>\
**Category:** MySQL & MariaDB\
**Created:** [October 27, 2021, 3:13pm UTC](https://forums.percona.com/t/events-on-master-master-replication/12780 "2021-10-27T15:13:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marekfc](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@marekfc](https://forums.percona.com/u/marekfc)\
**Post date:** [October 27, 2021, 3:13pm UTC](https://forums.percona.com/t/events-on-master-master-replication/12780/1 "2021-10-27T15:13:31Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [October 27, 2021, 3:38pm UTC](https://forums.percona.com/t/events-on-master-master-replication/12780/2 "2021-10-27T15:38:00Z")

</div>

‘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]`

[`event_scheduler`](https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_event_scheduler)

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.

---

<div class="post-metadata">

**Author:** ![marekfc](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@marekfc](https://forums.percona.com/u/marekfc)\
**Post date:** [October 27, 2021, 3:52pm UTC](https://forums.percona.com/t/events-on-master-master-replication/12780/3 "2021-10-27T15:52:40Z")

</div>

Thanks,  
I guess it will be same for Galera.

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [October 27, 2021, 5:38pm UTC](https://forums.percona.com/t/events-on-master-master-replication/12780/4 "2021-10-27T17:38:28Z")

</div>

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.
