| 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 |
############################################################ |
| 8 |
# 1. Deploy a group in multi-primary mode on server1 and server2. |
| 9 |
[connection server1] |
| 10 |
include/start_and_bootstrap_group_replication.inc |
| 11 |
[connection server2] |
| 12 |
include/start_group_replication.inc |
| 13 |
|
| 14 |
############################################################ |
| 15 |
# 2. Configure a failover channel on server1 that replicates |
| 16 |
# from server3. |
| 17 |
[connection server3] |
| 18 |
[connection server1] |
| 19 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_USER='root', SOURCE_AUTO_POSITION=1, SOURCE_CONNECTION_AUTO_FAILOVER=1, SOURCE_PORT=SERVER_3_PORT, SOURCE_CONNECT_RETRY=1, SOURCE_RETRY_COUNT=1 FOR CHANNEL 'ch1'; |
| 20 |
Warnings: |
| 21 |
Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure. |
| 22 |
Note 1760 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. |
| 23 |
SELECT asynchronous_connection_failover_add_source('ch1', '127.0.0.1', SERVER_MYPORT_3, '', 50);; |
| 24 |
asynchronous_connection_failover_add_source('ch1', '127.0.0.1', SERVER_MYPORT_3, '', 50) |
| 25 |
The UDF asynchronous_connection_failover_add_source() executed successfully. |
| 26 |
include/start_slave.inc [FOR CHANNEL 'ch1'] |
| 27 |
include/assert.inc ['There is 1 row in performance_schema.replication_asynchronous_connection_failover'] |
| 28 |
include/assert.inc ['The version of replication_asynchronous_connection_failover must be 1'] |
| 29 |
include/assert.inc ['SOURCE_CONNECTION_AUTO_FAILOVER must be enabled on ch1'] |
| 30 |
include/assert.inc [Verify channel ch1 IO_THREAD is ON and connected to server3] |
| 31 |
include/assert.inc [Verify replica_monitor thread is running] |
| 32 |
|
| 33 |
############################################################ |
| 34 |
# 3. Configure the same failover channel on server2. |
| 35 |
# In single-primary mode, the mode to which we will change, |
| 36 |
# the failover channels must exist on all members. |
| 37 |
# The channel is created with SOURCE_CONNECTION_AUTO_FAILOVER=0 |
| 38 |
# to show that it will change to SOURCE_CONNECTION_AUTO_FAILOVER=1 |
| 39 |
# when group mode changes to single-primary mode. |
| 40 |
[connection server2] |
| 41 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_USER='root', SOURCE_AUTO_POSITION=1, SOURCE_CONNECTION_AUTO_FAILOVER=0, SOURCE_PORT=SERVER_3_PORT, SOURCE_CONNECT_RETRY=1, SOURCE_RETRY_COUNT=1 FOR CHANNEL 'ch1'; |
| 42 |
Warnings: |
| 43 |
Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure. |
| 44 |
Note 1760 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. |
| 45 |
|
| 46 |
############################################################ |
| 47 |
# 4. Add some failovers sources to server2 that will be replaced |
| 48 |
# when server1 becomes the primary in single-primary mode. |
| 49 |
SELECT asynchronous_connection_failover_add_source('ch1', '10.0.0.1', 3306, '', 50); |
| 50 |
asynchronous_connection_failover_add_source('ch1', '10.0.0.1', 3306, '', 50) |
| 51 |
The UDF asynchronous_connection_failover_add_source() executed successfully. |
| 52 |
SELECT asynchronous_connection_failover_add_source('ch1', '10.0.0.2', 3306, '', 50); |
| 53 |
asynchronous_connection_failover_add_source('ch1', '10.0.0.2', 3306, '', 50) |
| 54 |
The UDF asynchronous_connection_failover_add_source() executed successfully. |
| 55 |
include/assert.inc ['There are 2 rows in performance_schema.replication_asynchronous_connection_failover'] |
| 56 |
SELECT * FROM performance_schema.replication_asynchronous_connection_failover; |
| 57 |
CHANNEL_NAME HOST PORT NETWORK_NAMESPACE WEIGHT MANAGED_NAME |
| 58 |
ch1 10.0.0.1 3306 50 |
| 59 |
ch1 10.0.0.2 3306 50 |
| 60 |
SELECT * FROM performance_schema.replication_group_configuration_version WHERE name LIKE 'replication_asynchronous_connection_failover'; |
| 61 |
name version |
| 62 |
replication_asynchronous_connection_failover 2 |
| 63 |
|
| 64 |
############################################################ |
| 65 |
# 5. Change to single-primary mode. |
| 66 |
# The primary must be server1, since when a member has |
| 67 |
# replication channels running it must be the primary. |
| 68 |
[connection server1] |
| 69 |
SELECT group_replication_switch_to_single_primary_mode("MEMBER1_UUID"); |
| 70 |
group_replication_switch_to_single_primary_mode("MEMBER1_UUID") |
| 71 |
Mode switched to single-primary successfully. |
| 72 |
include/gr_assert_primary_member.inc |
| 73 |
[connection server2] |
| 74 |
include/gr_assert_secondary_member.inc |
| 75 |
|
| 76 |
############################################################ |
| 77 |
# 6. Validate that server1 replication failover channels |
| 78 |
# configuration is preserved, and that it did replace the |
| 79 |
# one on server2. |
| 80 |
[connection server1] |
| 81 |
include/assert.inc ['There is 1 row in performance_schema.replication_asynchronous_connection_failover'] |
| 82 |
include/assert.inc ['The version of replication_asynchronous_connection_failover must be 1'] |
| 83 |
include/assert.inc ['SOURCE_CONNECTION_AUTO_FAILOVER must be enabled on ch1'] |
| 84 |
include/assert.inc [Verify channel ch1 IO_THREAD is ON and connected to server3] |
| 85 |
include/assert.inc ['Validate the number of workers on performance_schema.replication_applier_status_by_worker table for channel ch1'] |
| 86 |
include/assert.inc [Verify replica_monitor thread is running] |
| 87 |
SELECT * FROM performance_schema.replication_asynchronous_connection_failover; |
| 88 |
CHANNEL_NAME HOST PORT NETWORK_NAMESPACE WEIGHT MANAGED_NAME |
| 89 |
ch1 127.0.0.1 PORT 50 |
| 90 |
SELECT * FROM performance_schema.replication_group_configuration_version WHERE name LIKE 'replication_asynchronous_connection_failover'; |
| 91 |
name version |
| 92 |
replication_asynchronous_connection_failover 1 |
| 93 |
[connection server2] |
| 94 |
include/assert.inc ['There is 1 row in performance_schema.replication_asynchronous_connection_failover'] |
| 95 |
include/assert.inc ['The version of replication_asynchronous_connection_failover must be 1'] |
| 96 |
include/assert.inc ['SOURCE_CONNECTION_AUTO_FAILOVER must be enabled on ch1'] |
| 97 |
include/assert.inc [Verify channel ch1 IO_THREAD is OFF] |
| 98 |
include/assert.inc [Verify replica_monitor thread is not running] |
| 99 |
SELECT * FROM performance_schema.replication_asynchronous_connection_failover; |
| 100 |
CHANNEL_NAME HOST PORT NETWORK_NAMESPACE WEIGHT MANAGED_NAME |
| 101 |
ch1 127.0.0.1 PORT 50 |
| 102 |
SELECT * FROM performance_schema.replication_group_configuration_version WHERE name LIKE 'replication_asynchronous_connection_failover'; |
| 103 |
name version |
| 104 |
replication_asynchronous_connection_failover 1 |
| 105 |
|
| 106 |
############################################################ |
| 107 |
# 7. server1 leaves the group. |
| 108 |
# server2 is the new primary and does start the failover |
| 109 |
# channel. |
| 110 |
[connection server1] |
| 111 |
include/stop_group_replication.inc |
| 112 |
[connection server2] |
| 113 |
include/gr_wait_primary_member_uuid.inc |
| 114 |
include/wait_for_slave_to_start.inc [FOR CHANNEL 'ch1'] |
| 115 |
include/assert.inc ['There is 1 row in performance_schema.replication_asynchronous_connection_failover'] |
| 116 |
include/assert.inc ['The version of replication_asynchronous_connection_failover must be 1'] |
| 117 |
include/assert.inc ['SOURCE_CONNECTION_AUTO_FAILOVER must be enabled on ch1'] |
| 118 |
include/assert.inc [Verify channel ch1 IO_THREAD is ON and connected to server3] |
| 119 |
include/assert.inc ['Validate the number of workers on performance_schema.replication_applier_status_by_worker table for channel ch1'] |
| 120 |
include/assert.inc [Verify replica_monitor thread is running] |
| 121 |
SELECT * FROM performance_schema.replication_asynchronous_connection_failover; |
| 122 |
CHANNEL_NAME HOST PORT NETWORK_NAMESPACE WEIGHT MANAGED_NAME |
| 123 |
ch1 127.0.0.1 PORT 50 |
| 124 |
SELECT * FROM performance_schema.replication_group_configuration_version WHERE name LIKE 'replication_asynchronous_connection_failover'; |
| 125 |
name version |
| 126 |
replication_asynchronous_connection_failover 1 |
| 127 |
|
| 128 |
############################################################ |
| 129 |
# 8. Clean up. |
| 130 |
[connection server2] |
| 131 |
include/stop_group_replication.inc |
| 132 |
include/rpl_reset_slave.inc |
| 133 |
[connection server1] |
| 134 |
include/rpl_reset_slave.inc |
| 135 |
[connection server3] |
| 136 |
include/stop_dump_threads.inc |
| 137 |
include/group_replication_end.inc |