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
|
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]
# 1. Start a group in single primary mode.
include/start_and_bootstrap_group_replication.inc
CREATE TABLE test.t1 (a INT PRIMARY KEY);
[connection server2]
include/start_group_replication.inc
# 2. Go to a member that will be a secondary and lock a table
[connection server3]
include/start_group_replication.inc
SET @@GLOBAL.read_only= 0;
LOCK TABLE t1 READ;
# 3. Insert a row on primary
[connection server1]
INSERT INTO t1 VALUES (1);
# 4. Invoke a change the primary to server2
[connection server2]
SELECT group_replication_set_as_primary("MEMBER2_UUID");
# 5. Check that the other members are waiting for members to be in read
# mode.
# Stages should be
# - Primary Election: waiting for members to enable super_read_only
# - Primary Switch: executing Primary election
[connection server_2]
include/assert.inc [stage/group_rpl/Primary Switch: executing Primary election]
include/assert.inc [stage/group_rpl/Primary Election: waiting for members to enable super_read_only]
# 6. Kill the stuck secondary
[connection server3]
# Kill and restart:--group-replication-start-on-boot=0 --group-replication-group-name=GROUP_REPLICATION_GROUP_NAME --group_replication_local_address=GROUP_REPLICATION_LOCAL_ADDRESS --group_replication_group_seeds=GROUP_REPLICATION_GROUP_SEEDS --group_replication_single_primary_mode=TRUE --group_replication_enforce_update_everywhere_checks=FALSE --group_replication_communication_stack=GROUP_REPLICATION_COMMUNICATION_STACK
include/rpl_reconnect.inc
# 7. Check that the action finishes
[connection server2]
group_replication_set_as_primary("MEMBER2_UUID")
Primary server switched to: MEMBER2_UUID
# 8. Check that primary is now server2
include/gr_assert_primary_member.inc
[connection server1]
include/gr_assert_secondary_member.inc
# 9. Cleanup
[connection server2]
DROP TABLE t1;
[connection server3]
DROP TABLE t1;
include/group_replication_end.inc
|