| 1 |
include/master-slave.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 master] |
| 6 |
call mtr.add_suppression("Hostname .* does not resolve to"); |
| 7 |
call mtr.add_suppression("IP address .* could not be resolved"); |
| 8 |
# Add a bind address in the 'red' network namespace to master |
| 9 |
include/rpl_restart_server.inc [server_number=1 parameters: --bind-address=127.0.0.1,10.0.2.1/red] |
| 10 |
# Add a bind address in the 'blue' network namespace to the slave |
| 11 |
include/rpl_restart_server.inc [server_number=2 parameters: --bind-address=127.0.0.1,10.0.1.1/blue] |
| 12 |
include/start_slave.inc |
| 13 |
# Create tables and users. |
| 14 |
CREATE TABLE t1(a int primary key, b varchar(10)); |
| 15 |
CREATE USER [email protected]; |
| 16 |
GRANT ALL ON *.* TO [email protected]; |
| 17 |
CREATE USER [email protected]; |
| 18 |
GRANT ALL ON *.* TO [email protected]; |
| 19 |
#Insert via connection to the address 127.0.0.1 from the default network namespace |
| 20 |
INSERT INTO t1 VALUES (1, 'abc'); |
| 21 |
#Insert via connection to the address 10.0.2.1 from the 'red' network namespace |
| 22 |
SHOW CREATE TABLE t1; |
| 23 |
Table Create Table |
| 24 |
t1 CREATE TABLE `t1` ( |
| 25 |
`a` int NOT NULL, |
| 26 |
`b` varchar(10) DEFAULT NULL, |
| 27 |
PRIMARY KEY (`a`) |
| 28 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 29 |
[ connection slave ] |
| 30 |
include/sync_slave_sql_with_master.inc |
| 31 |
SHOW CREATE TABLE t1; |
| 32 |
Table Create Table |
| 33 |
t1 CREATE TABLE `t1` ( |
| 34 |
`a` int NOT NULL, |
| 35 |
`b` varchar(10) DEFAULT NULL, |
| 36 |
PRIMARY KEY (`a`) |
| 37 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 38 |
# Check network namspace of currently connected master |
| 39 |
SELECT network_namespace AS master_network_namespace FROM performance_schema.replication_connection_configuration; |
| 40 |
master_network_namespace |
| 41 |
|
| 42 |
SELECT Network_namespace FROM mysql.slave_master_info; |
| 43 |
Network_namespace |
| 44 |
|
| 45 |
Namespace from 'SHOW SLAVE STATUS' : |
| 46 |
# Check slave connection on the 'blue' namespace |
| 47 |
a b |
| 48 |
1 abc |
| 49 |
2 cdf |
| 50 |
# Stop slave and run change master to listen to the master on socket |
| 51 |
# created in the 'red' namespace |
| 52 |
include/stop_slave.inc |
| 53 |
[ connection master ] |
| 54 |
#Insert via connection to the address 127.0.0.1 from the default network namespace |
| 55 |
INSERT INTO t1 VALUES (3, 'ghi'); |
| 56 |
#Insert via connection to the address 10.0.2.1 from the 'red' network namespace |
| 57 |
[ connection slave ] |
| 58 |
# Change master to listen to the master on IP '10.0.2.1' in the 'red' namespace |
| 59 |
include/start_slave.inc |
| 60 |
include/sync_slave_sql_with_master.inc |
| 61 |
# Check network namspace of currently connected master |
| 62 |
SELECT network_namespace AS master_network_namespace FROM performance_schema.replication_connection_configuration; |
| 63 |
master_network_namespace |
| 64 |
red |
| 65 |
SELECT Network_namespace FROM mysql.slave_master_info; |
| 66 |
Network_namespace |
| 67 |
red |
| 68 |
Namespace from 'SHOW SLAVE STATUS' : red |
| 69 |
# Check slave connection on the 'blue' namespace |
| 70 |
a b |
| 71 |
1 abc |
| 72 |
2 cdf |
| 73 |
3 ghi |
| 74 |
4 jkl |
| 75 |
# Check that the table is replicated properly |
| 76 |
include/diff_tables.inc [master:t1, slave:t1] |
| 77 |
include/stop_slave.inc |
| 78 |
[ connection master ] |
| 79 |
[ connection slave ] |
| 80 |
# Change master to original connection |
| 81 |
include/start_slave.inc |
| 82 |
INSERT INTO t1 VALUES (5, 'mno'); |
| 83 |
include/sync_slave_sql_with_master.inc |
| 84 |
# Check network namspace of currently connected master |
| 85 |
SELECT network_namespace AS master_network_namespace FROM performance_schema.replication_connection_configuration; |
| 86 |
master_network_namespace |
| 87 |
|
| 88 |
SELECT Network_namespace FROM mysql.slave_master_info; |
| 89 |
Network_namespace |
| 90 |
|
| 91 |
Namespace from 'SHOW SLAVE STATUS' : |
| 92 |
# Check that the table is replicated properly |
| 93 |
include/diff_tables.inc [master:t1, slave:t1] |
| 94 |
# Cleanup |
| 95 |
DROP USER [email protected]; |
| 96 |
DROP USER [email protected]; |
| 97 |
DROP TABLE t1; |
| 98 |
include/sync_slave_sql_with_master.inc |
| 99 |
include/rpl_end.inc |