Switching the MGR Role
- Specify the ID of the member to be switched.
show variables like '%server_%'; SELECT * FROM performance_schema.replication_group_members;
- Switch the MGR role.
SELECT group_replication_set_as_primary('Replace it with the member_id of the target primary database');For example:
SELECT group_replication_set_as_primary('e44f902b-bf50-11ea-89d7-000000536bb6');+--------------------------------------------------------------------------+ | 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.
SELECT event_name, work_completed, work_estimated FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl%";
Parent topic: Maintaining MGR