Rechercher dans le manuel MySQL
18.4.1.1 Changing a Group's Primary Member
This section explains how to change which member of a single-primary group is the primary. The function used to change a group's mode can be run on any member.
Changing which Member is Primary
Use the
group_replication_set_as_primary()
UDF to change which member is the primary in a single-primary
group. This function has no effect if issued on a member of a
multi-primary group. Only a primary member can write to the
group, so if an asynchronous channel is running on that
member, no switch is allowed until the asynchronous channel is
stopped.
If you issue the UDF on a member running a MySQL Server version from 8.0.17, and all members are running MySQL Server version 8.0.17 or higher, you can only specify a new primary member that is running the lowest MySQL Server version in the group, based on the patch version. This safeguard is applied to ensure the group maintains compatibility with new functions. If any member is running a MySQL Server version between MySQL 8.0.13 and MySQL 8.0.16, this safeguard is not enforced for the group and you can specify any new primary member, but it is recommended to select a primary that is running the lowest MySQL Server version in the group.
Pass in the server_uuid
of
the member which you want to become the new primary of the
group by issuing:
While the action runs, you can check its progress by issuing:
- +----------------------------------------------------------------------------------+----------------+----------------+
- | event_name | work_completed | work_estimated |
- +----------------------------------------------------------------------------------+----------------+----------------+
- +----------------------------------------------------------------------------------+----------------+----------------+
Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-group-replication-changing-primary-member.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.