Group Replication uses the asynchronous replication protocol to
achieve distributed recovery, synchronizing group members before
joining them to the group. The distributed recovery process
relies on a replication channel named
group_replication_recovery which is used to
transfer transactions between group members. Therefore you need
to set up a replication user with the correct permissions so
that Group Replication can establish direct member-to-member
recovery replication channels.
Start the server:
mysql-5.7/bin/mysqld --defaults-file=data/s1/s1.cnf
Create a MySQL user with the
REPLICATION-SLAVE privilege. This
process should not be captured in the
binary log to avoid the changes being propagated to other server
instances. In the following example the user
rpl_user with the password
rpl_pass is shown. When configuring
your servers use a suitable user name and password. Connect to
server s1 and issue the following statements:
mysql> SET SQL_LOG_BIN=0;
Query OK, 0 rows affected (0,00 sec)
mysql> CREATE USER rpl_user@'%' IDENTIFIED BY 'rpl_pass';
Query OK, 0 rows affected (0,00 sec)
mysql> GRANT REPLICATION SLAVE ON *.* TO rpl_user@'%';
Query OK, 0 rows affected, 1 warning (0,00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0,00 sec)
mysql> SET SQL_LOG_BIN=1;
Query OK, 0 rows affected (0,00 sec)
Once the user has been configured as above, use the
CHANGE MASTER TO statement to
configure the server to use the given credentials for the
group_replication_recovery replication
channel the next time it needs to recover its state from another
member. Issue the following, replacing
rpl_user and
rpl_pass with the values used when
creating the user.
mysql> CHANGE MASTER TO MASTER_USER='rpl_user', MASTER_PASSWORD='rpl_pass' \\
FOR CHANNEL 'group_replication_recovery';
Query OK, 0 rows affected, 2 warnings (0,01 sec)
Distributed recovery is the first step taken by a server that
joins the group. If these credentials are not set correctly as
shown, the server cannot run the recovery process and gain
synchrony with the other group members, and hence ultimately
cannot join the group. Similarly, if the member cannot correctly
identify the other members via the server's
hostname the recovery process can fail. It is
recommended that operating systems running MySQL have a properly
configured unique hostname, either using DNS
or local settings. This hostname can be
verified in the Member_host column of the
performance_schema.replication_group_members
table. If multiple group members externalize a default
hostname set by the operating system, there
is a chance of the member not resolving to the correct member
address and not being able to join the group. In such a
situation use report_host to
configure a unique hostname to be
externalized by each of the servers.