Switching the MGR Role
- Specify the ID of the member to be switched.
1 2
show variables like '%server_%'; SELECT * FROM performance_schema.replication_group_members;
- Switch the MGR role.
1SELECT group_replication_set_as_primary('Replace it with the member_id of the target primary database');
For example:
1SELECT group_replication_set_as_primary('e44f902b-bf50-11ea-89d7-000000536bb6');
1 2 3 4 5 6
+--------------------------------------------------------------------------+ | group_replication_set_as_primary('e44f902b-bf50-11ea-89d7-000000536bb6') | +--------------------------------------------------------------------------+ | Primary server switched to: e44f902b-bf50-11ea-89d7-000000536bb6 | +--------------------------------------------------------------------------+ 1 row in set (1.00 sec)
Confirm the switchover progress.
1SELECT event_name, work_completed, work_estimated FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%";
Parent topic: Maintaining MGR