| 1 |
--source include/have_ndb.inc |
| 2 |
|
| 3 |
# setup replication 1->2->3 |
| 4 |
--let $rpl_topology= 1->2->3 |
| 5 |
--source include/rpl_init.inc |
| 6 |
|
| 7 |
# create connections to first mysqld in each cluster |
| 8 |
--let $rpl_connection_name= cluster1 |
| 9 |
--let $rpl_server_number= 1 |
| 10 |
--source include/rpl_connect.inc |
| 11 |
|
| 12 |
--let $rpl_connection_name= cluster2 |
| 13 |
--let $rpl_server_number= 2 |
| 14 |
--source include/rpl_connect.inc |
| 15 |
|
| 16 |
--let $rpl_connection_name= cluster3 |
| 17 |
--let $rpl_server_number= 3 |
| 18 |
--source include/rpl_connect.inc |
| 19 |
|
| 20 |
--let $rpl_connection_name= cluster1 |
| 21 |
--source include/rpl_connection.inc |
| 22 |
let $CLUSTER1_SERVER_ID= `select @@server_id`; |
| 23 |
echo CLUSTER1_SERVER_ID: $CLUSTER1_SERVER_ID; |
| 24 |
|
| 25 |
--let $rpl_connection_name= cluster2 |
| 26 |
--source include/rpl_connection.inc |
| 27 |
show variables like 'server_id'; |
| 28 |
|
| 29 |
--let $rpl_connection_name= cluster3 |
| 30 |
--source include/rpl_connection.inc |
| 31 |
show variables like 'server_id'; |
| 32 |
|
| 33 |
--echo First show replication 1->2->3 |
| 34 |
--let $rpl_connection_name= cluster1 |
| 35 |
--source include/rpl_connection.inc |
| 36 |
use test; |
| 37 |
create table t1(a int primary key, b varchar(50)) engine=ndb; |
| 38 |
|
| 39 |
insert into t1 values (1,'Summertime'); |
| 40 |
|
| 41 |
--sync_slave_with_master cluster2 |
| 42 |
--echo Cluster2 has insert and apply_status from Cluster1 |
| 43 |
show variables like 'server_id'; |
| 44 |
--replace_column 2 # 4 # 5 # |
| 45 |
select * from mysql.ndb_apply_status order by server_id; |
| 46 |
select * from test.t1; |
| 47 |
|
| 48 |
# Wait for replicated changes to be binlogged |
| 49 |
--source include/wait_for_ndb_committed_to_binlog.inc |
| 50 |
|
| 51 |
# Show the binlog on cluster2, include server_id in output |
| 52 |
# since it's interesting to see how those are propagated |
| 53 |
--let $show_binlog_events_verbose = 1 |
| 54 |
--let $show_binlog_events_mask_columns = 2,5 |
| 55 |
--source include/show_binlog_events.inc |
| 56 |
|
| 57 |
--sync_slave_with_master cluster3 |
| 58 |
--echo Cluster3 has insert and apply_status from Cluster1+2 |
| 59 |
show variables like 'server_id'; |
| 60 |
--replace_column 2 # 4 # 5 # |
| 61 |
select * from mysql.ndb_apply_status order by server_id; |
| 62 |
select * from test.t1; |
| 63 |
|
| 64 |
--echo Break Cluster3's link with Cluster2 |
| 65 |
--let $rpl_connection_name= cluster3 |
| 66 |
--source include/rpl_connection.inc |
| 67 |
|
| 68 |
--source include/stop_slave.inc |
| 69 |
|
| 70 |
--echo Make further changes on Cluster1 |
| 71 |
--let $rpl_connection_name= cluster1 |
| 72 |
--source include/rpl_connection.inc |
| 73 |
insert into test.t1 values (2, "The cotton is high"); |
| 74 |
insert into test.t1 values (3, "Daddys rich"); |
| 75 |
|
| 76 |
--sync_slave_with_master cluster2 |
| 77 |
--echo Show changes exist on Cluster2 |
| 78 |
select * from test.t1 order by a; |
| 79 |
|
| 80 |
--echo Check data on Cluster3 |
| 81 |
--let $rpl_connection_name= cluster3 |
| 82 |
--source include/rpl_connection.inc |
| 83 |
select * from test.t1 order by a; |
| 84 |
|
| 85 |
--echo Now change Cluster3 to skip-over Cluster2 and get binlog direct from Cluster1 |
| 86 |
|
| 87 |
--replace_column 2 # 4 # 5 # |
| 88 |
select * from mysql.ndb_apply_status order by server_id; |
| 89 |
|
| 90 |
let $CLUSTER1_LOG_FILE= `select log_name from mysql.ndb_apply_status |
| 91 |
where server_id = $CLUSTER1_SERVER_ID`; |
| 92 |
let $CLUSTER1_LOG_POS= `select end_pos from mysql.ndb_apply_status |
| 93 |
where server_id = $CLUSTER1_SERVER_ID`; |
| 94 |
|
| 95 |
# Avoid warnings about epoch# differences between Cluster 2 and Cluster 1 |
| 96 |
reset slave; |
| 97 |
|
| 98 |
--let $rpl_topology= 1->2, 1->3 |
| 99 |
--let $rpl_master_log_file= 3:$CLUSTER1_LOG_FILE |
| 100 |
--let $rpl_master_log_pos= 3:$CLUSTER1_LOG_POS |
| 101 |
--source include/rpl_change_topology.inc |
| 102 |
|
| 103 |
--source include/start_slave.inc |
| 104 |
|
| 105 |
--let $rpl_connection_name= cluster1 |
| 106 |
--source include/rpl_connection.inc |
| 107 |
--sync_slave_with_master cluster3 |
| 108 |
|
| 109 |
--echo Now show that cluster 3 is successfully replicating from Cluster1 |
| 110 |
--let $rpl_connection_name= cluster3 |
| 111 |
--source include/rpl_connection.inc |
| 112 |
select * from test.t1 order by a; |
| 113 |
|
| 114 |
--echo Clean up |
| 115 |
--let $rpl_connection_name= cluster1 |
| 116 |
--source include/rpl_connection.inc |
| 117 |
drop table test.t1; |
| 118 |
|
| 119 |
--source include/rpl_end.inc |
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|