| 1 |
include/group_replication.inc |
| 2 |
Warnings: |
| 3 |
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. |
| 4 |
Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. |
| 5 |
[connection server1] |
| 6 |
# |
| 7 |
# 1. Install clone plugin on server1. |
| 8 |
[connection server1] |
| 9 |
INSTALL PLUGIN clone SONAME 'CLONE_PLUGIN'; |
| 10 |
# |
| 11 |
# 2. Set a privileged user for server 1 GR recovery channel |
| 12 |
CREATE USER 'u1'@'localhost'; |
| 13 |
GRANT SESSION_VARIABLES_ADMIN, REPLICATION_APPLIER ON *.* TO 'u1'@'localhost'; |
| 14 |
GRANT CREATE,INSERT ON *.* TO 'u1'@'localhost'; |
| 15 |
CHANGE REPLICATION SOURCE TO PRIVILEGE_CHECKS_USER = 'u1'@'localhost' FOR CHANNEL 'group_replication_recovery'; |
| 16 |
# |
| 17 |
# 3. Bootstrap server1 and add some data |
| 18 |
include/start_and_bootstrap_group_replication.inc |
| 19 |
CREATE DATABASE db1; |
| 20 |
CREATE TABLE db1.t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 21 |
INSERT INTO db1.t1 VALUES (1); |
| 22 |
# |
| 23 |
# 4. Restart server 2 with a monitoring process (mysqld_safe) if needed |
| 24 |
[connection server2] |
| 25 |
include/spawn_monitoring_process.inc |
| 26 |
# |
| 27 |
# 5. Setup the server so group replication starts on boot |
| 28 |
# Install the Clone plugin |
| 29 |
INSTALL PLUGIN clone SONAME 'CLONE_PLUGIN'; |
| 30 |
# |
| 31 |
# 6. On a empty server2 start group replication |
| 32 |
# Wait for it to restart and come back |
| 33 |
# Check clone was completed |
| 34 |
SET GLOBAL group_replication_clone_threshold= 1; |
| 35 |
START GROUP_REPLICATION; |
| 36 |
include/rpl_reconnect.inc |
| 37 |
include/gr_wait_for_member_state.inc |
| 38 |
include/assert.inc [Clone must be completed] |
| 39 |
include/diff_tables.inc [server1:db1.t1,server2:db1.t1] |
| 40 |
# |
| 41 |
# 7. Check that the recovery privileged user was preserved |
| 42 |
[connection server1] |
| 43 |
include/assert.inc [Credentials on server 1 are preserved] |
| 44 |
[connection server2] |
| 45 |
include/assert.inc [Credentials on server 2 were proprely cloned] |
| 46 |
include/assert.inc [Performance schema values on server 2 are correct] |
| 47 |
# |
| 48 |
# 8. Cleanup |
| 49 |
SET GLOBAL group_replication_clone_threshold= 9223372036854775807; |
| 50 |
RESET PERSIST IF EXISTS group_replication_group_name; |
| 51 |
RESET PERSIST IF EXISTS group_replication_local_address; |
| 52 |
RESET PERSIST IF EXISTS group_replication_group_seeds; |
| 53 |
RESET PERSIST IF EXISTS group_replication_start_on_boot; |
| 54 |
RESET PERSIST IF EXISTS group_replication_communication_stack; |
| 55 |
DROP TABLE db1.t1; |
| 56 |
DROP DATABASE db1; |
| 57 |
include/rpl_sync.inc |
| 58 |
[connection server1] |
| 59 |
CHANGE REPLICATION SOURCE TO PRIVILEGE_CHECKS_USER = NULL FOR CHANNEL 'group_replication_recovery'; |
| 60 |
[connection server2] |
| 61 |
CHANGE REPLICATION SOURCE TO PRIVILEGE_CHECKS_USER = NULL FOR CHANNEL 'group_replication_recovery'; |
| 62 |
[connection server1] |
| 63 |
DROP USER u1@localhost; |
| 64 |
UNINSTALL PLUGIN clone; |
| 65 |
[connection server2] |
| 66 |
UNINSTALL PLUGIN clone; |
| 67 |
set session sql_log_bin=0; |
| 68 |
call mtr.add_suppression("This member will start distributed recovery using clone. It is due to the number of missing transactions being higher than the configured threshold of*"); |
| 69 |
call mtr.add_suppression("Clone removing all user data for provisioning: Started"); |
| 70 |
call mtr.add_suppression("Clone removing all user data for provisioning: Finished"); |
| 71 |
set session sql_log_bin=1; |
| 72 |
include/clean_monitoring_process.inc |
| 73 |
SET GLOBAL group_replication_start_on_boot= START_ON_BOOT_VALUE; |
| 74 |
include/group_replication_end.inc |