19.3.3.2 Privilege Checks For Group Replication Channels (original) (raw)
19.3.3.2 Privilege Checks For Group Replication Channels
You can also use a PRIVILEGE_CHECKS_USER
account to secure the two replication applier threads used by Group Replication. Thegroup_replication_applier
thread on each group member is used for applying group transactions, and thegroup_replication_recovery
thread on each group member is used for state transfer from the binary log as part of distributed recovery when the member joins or rejoins the group.
To secure one of these threads, stop Group Replication, then issue the CHANGE REPLICATION SOURCE TO statement with thePRIVILEGE_CHECKS_USER
option, specifyinggroup_replication_applier
orgroup_replication_recovery
as the channel name. For example:
mysql> STOP GROUP_REPLICATION;
mysql> CHANGE REPLICATION SOURCE TO PRIVILEGE_CHECKS_USER = 'gr_repl'@'%.example.com'
FOR CHANNEL 'group_replication_recovery';
mysql> FLUSH PRIVILEGES;
mysql> START GROUP_REPLICATION;
For Group Replication channels, theREQUIRE_ROW_FORMAT
setting is automatically enabled when the channel is created, and cannot be disabled, so you do not need to specify this.
Group Replication requires every table that is to be replicated by the group to have a defined primary key, or primary key equivalent where the equivalent is a non-null unique key. Rather than using the checks carried out by thesql_require_primary_key system variable, Group Replication has its own built-in set of checks for primary keys or primary key equivalents. You may set theREQUIRE_TABLE_PRIMARY_KEY_CHECK
option of theCHANGE REPLICATION SOURCE TO statement to ON
for a Group Replication channel. However, be aware that you might find some transactions that are permitted under Group Replication's built-in checks are not permitted under the checks carried out when you setsql_require_primary_key = ON
orREQUIRE_TABLE_PRIMARY_KEY_CHECK = ON
. For this reason, new and upgraded Group Replication channels haveREQUIRE_TABLE_PRIMARY_KEY_CHECK
set to the default value STREAM
, rather thanON
.
If a remote cloning operation is used for distributed recovery in Group Replication (seeSection 20.5.4.2, “Cloning for Distributed Recovery”), thePRIVILEGE_CHECKS_USER
account and related settings from the donor are cloned to the joining member. If the joining member is set to start Group Replication on boot, it automatically uses the account for privilege checks on the appropriate replication channels.