20.2.1.3 User Credentials For Distributed Recovery (original) (raw)

20.2.1.3 User Credentials For Distributed Recovery

Group Replication uses a distributed recovery process to synchronize group members when joining them to the group. Distributed recovery involves transferring transactions from a donor's binary log to a joining member using a replication channel named group_replication_recovery. You must therefore set up a replication user with the correct permissions so that Group Replication can establish direct member-to-member replication channels. If group members have been set up to support the use of a remote cloning operation as part of distributed recovery, this replication user is also used as the clone user on the donor, and requires the correct permissions for this role too. For a complete description of distributed recovery, seeSection 20.5.4, “Distributed Recovery”.

The same replication user must be used for distributed recovery on every group member. The process of creating the replication user for distributed recovery can be captured in the binary log, and then you can rely on distributed recovery to replicate the statements used to create the user. Alternatively, you can disable binary logging before creating the replication user, and then create the user manually on each member, for example if you want to avoid the changes being propagated to other server instances. If you do this, ensure you re-enable binary logging once you have configured the user.

Important

If distributed recovery connections for your group use SSL, the replication user must be created on each server_before_ the joining member connects to the donor. For instructions to set up SSL for distributed recovery connections and create a replication user that requires SSL, seeSection 20.6.3, “Securing Distributed Recovery Connections”

To create the replication user for distributed recovery, follow these steps:

  1. Start the MySQL server instance, then connect a client to it.
  2. If you want to disable binary logging in order to create the replication user separately on each instance, do so by issuing the following statement:
mysql> SET SQL_LOG_BIN=0;  
  1. Create a MySQL user with the following privileges:
mysql> CREATE USER rpl_user@'%' IDENTIFIED BY 'password';  
mysql> GRANT REPLICATION SLAVE ON *.* TO rpl_user@'%';  
mysql> GRANT CONNECTION_ADMIN ON *.* TO rpl_user@'%';  
mysql> GRANT BACKUP_ADMIN ON *.* TO rpl_user@'%';  
mysql> GRANT GROUP_REPLICATION_STREAM ON *.* TO rpl_user@'%';  
mysql> FLUSH PRIVILEGES;  
  1. If you disabled binary logging, enable it again as soon as you have created the user, by issuing the following statement:
mysql> SET SQL_LOG_BIN=1;  
  1. When you have created the replication user, you must supply the user credentials to the server for use with distributed recovery. You can do this by setting the user credentials as the credentials for thegroup_replication_recovery channel, using a CHANGE REPLICATION SOURCE TO statement. Alternatively, you can specify the user credentials for distributed recovery in aSTART GROUP_REPLICATION statement.
mysql> CHANGE REPLICATION SOURCE TO SOURCE_USER='rpl_user',  
    ->   SOURCE_PASSWORD='password'  
    ->   FOR CHANNEL 'group_replication_recovery';