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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
include/group_replication.inc
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 server M1 and M2 with gms_listener service implementation.
# Set M2 member weight to 90. M2 becomes primary during mode change.
# Delete all notifications on M1 and M2.
# Adding debug point 'register_gms_listener_example' to @@GLOBAL.debug
SET SQL_LOG_BIN=0;
CREATE TABLE test.gms_listener_example(log_message TEXT);
SET SQL_LOG_BIN=1;
include/start_and_bootstrap_group_replication.inc
[connection server2]
SET @member_weight2_save= @@GLOBAL.group_replication_member_weight;
SET GLOBAL group_replication_member_weight= 90;
# Adding debug point 'register_gms_listener_example' to @@GLOBAL.debug
SET SQL_LOG_BIN=0;
CREATE TABLE test.gms_listener_example(log_message TEXT);
SET SQL_LOG_BIN=1;
include/start_group_replication.inc
include/assert.inc [Assert that there are 2 notifications logged of type STATE %:2]
include/assert.inc [Assert that there are 1 notifications logged of type VIEW %:%]
include/assert.inc [Assert that there are 3 notifications logged]
[Truncating gms_listener_example Table]
[connection server1]
include/assert.inc [Assert that there are 2 notifications logged of type STATE %:2]
include/assert.inc [Assert that there are 2 notifications logged of type STATE %:1]
include/assert.inc [Assert that there are 2 notifications logged of type VIEW %:%]
include/assert.inc [Assert that there are 6 notifications logged]
[Truncating gms_listener_example Table]
# 2. Change mode to SPM. M2 becomes primary due to weight.
# Assert ROLE notification is broadcasted.
SELECT group_replication_switch_to_single_primary_mode();
group_replication_switch_to_single_primary_mode()
Mode switched to single-primary successfully.
include/gr_assert_secondary_member.inc
include/assert.inc [Assert that there are 1 notifications logged of type ROLE %:%]
include/assert.inc [Assert that there are 1 notifications logged]
[Truncating gms_listener_example Table]
[connection server2]
include/gr_assert_primary_member.inc
include/assert.inc [Assert that there are 1 notifications logged of type ROLE %:%]
include/assert.inc [Assert that there are 1 notifications logged]
[Truncating gms_listener_example Table]
# 3. Change mode to MPM.
# Assert ROLE notification is broadcasted.
[connection server1]
SELECT group_replication_switch_to_multi_primary_mode();
group_replication_switch_to_multi_primary_mode()
Mode switched to multi-primary successfully.
include/gr_assert_multi_primary_mode.inc
include/assert.inc [Assert that there are 1 notifications logged of type ROLE %:%]
include/assert.inc [Assert that there are 1 notifications logged]
[Truncating gms_listener_example Table]
[connection server2]
include/gr_assert_multi_primary_mode.inc
include/assert.inc [Assert that there are 1 notifications logged of type ROLE %:%]
include/assert.inc [Assert that there are 1 notifications logged]
[Truncating gms_listener_example Table]
# 4. Change mode to SPM specifying server1 as primary.
# Assert ROLE notification is broadcasted.
[connection server1]
SELECT group_replication_switch_to_single_primary_mode("MEMBER1_UUID");;
group_replication_switch_to_single_primary_mode("MEMBER1_UUID")
Mode switched to single-primary successfully.
include/gr_assert_primary_member.inc
include/assert.inc [Assert that there are 1 notifications logged of type ROLE %:%]
include/assert.inc [Assert that there are 1 notifications logged]
[Truncating gms_listener_example Table]
[connection server2]
include/gr_assert_secondary_member.inc
include/assert.inc [Assert that there are 1 notifications logged of type ROLE %:%]
include/assert.inc [Assert that there are 1 notifications logged]
[Truncating gms_listener_example Table]
# 5. Switch primary.
# Assert ROLE notification is broadcasted.
[connection server1]
SELECT group_replication_set_as_primary("MEMBER2_UUID");
group_replication_set_as_primary("MEMBER2_UUID")
Primary server switched to: MEMBER2_UUID
include/gr_assert_secondary_member.inc
include/assert.inc [Assert that there are 1 notifications logged of type ROLE %:%]
include/assert.inc [Assert that there are 1 notifications logged]
[Truncating gms_listener_example Table]
[connection server2]
include/gr_assert_primary_member.inc
include/assert.inc [Assert that there are 1 notifications logged of type ROLE %:%]
include/assert.inc [Assert that there are 1 notifications logged]
[Truncating gms_listener_example Table]
# 6. Cleanup.
SELECT group_replication_switch_to_multi_primary_mode();
group_replication_switch_to_multi_primary_mode()
Mode switched to multi-primary successfully.
SET SQL_LOG_BIN=0;
DROP TABLE test.gms_listener_example;
SET SQL_LOG_BIN=1;
SET @@GLOBAL.group_replication_member_weight= @member_weight2_save;
include/stop_group_replication.inc
# Removing debug point 'register_gms_listener_example' from @@GLOBAL.debug
[connection server1]
SET SQL_LOG_BIN=0;
DROP TABLE test.gms_listener_example;
SET SQL_LOG_BIN=1;
include/stop_group_replication.inc
# Removing debug point 'register_gms_listener_example' from @@GLOBAL.debug
include/group_replication_end.inc
|