1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
include/group_replication.inc [rpl_server_count=3]
Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
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.
[connection server1]
[connection server1]
set session sql_log_bin=0;
call mtr.add_suppression("There was an error when connecting to the donor*");
call mtr.add_suppression("For details please check performance_schema.replication_connection_status table and error log messages of Replica I/O for channel group_replication_recovery.");
set session sql_log_bin=1;
include/start_and_bootstrap_group_replication.inc
[connection server2]
SET GLOBAL group_replication_member_weight= 70;
include/start_group_replication.inc
############################################################
# 1. Configure server 3 recovery user, so it is the only
# viable donor for server1 on step #4
[connection server3]
SET SESSION sql_log_bin= 0;
CREATE USER "recovery_user" IDENTIFIED BY "recovery_password";
GRANT REPLICATION SLAVE ON *.* TO "recovery_user";
SET SESSION sql_log_bin= 1;
include/start_group_replication.inc
[connection server1]
include/gr_wait_primary_member_uuid.inc
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INT) ENGINE=InnoDB;
include/rpl_sync.inc
###########################################################
# 2. Lock the table on server 2 and insert data server 1.
# This will prevent server2 from from applying the old data
# once it is elected as primary.
[connection server_2]
LOCK TABLE t1 READ;
[connection server1]
INSERT INTO t1 VALUES(1,1);
###########################################################
# 3. Stop server 1 (primary) and validate thar server 2 is
# the new primary.
include/stop_group_replication.inc
[connection server2]
include/rpl_gr_wait_for_number_of_members.inc
include/assert.inc [Verify group_replication_primary_member is SERVER_UUID]
###########################################################
# 4. Configure server 1 with recovery credentials from server
# 3 and start group replication.
[connection server1]
CHANGE REPLICATION SOURCE TO SOURCE_USER='recovery_user', SOURCE_PASSWORD='recovery_password' FOR CHANNEL 'group_replication_recovery';
include/start_group_replication.inc
###########################################################
# 5. Insert a transaction on server 2. Since the server is
# still in read mode, it shall fail.
[connection server2]
INSERT INTO t1 VALUES(1,2);
ERROR HY000: The MySQL server is running with the --super-read-only option so it cannot execute this statement
[connection server_2]
UNLOCK TABLES;
include/assert.inc ['The value of Count_conflicts_detected should be 0 on server 2']
###########################################################
# 6. Clean up.
[connection server3]
SET SESSION sql_log_bin= 0;
SET GLOBAL read_only= 0;
DROP USER recovery_user;
SET GLOBAL super_read_only= 1;
SET SESSION sql_log_bin= 1;
[connection server2]
DROP TABLE t1;
SET GLOBAL group_replication_member_weight= DEFAULT;
include/group_replication_end.inc
|