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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
#############################################################
# Author: Serge Kozlov <skozlov@mysql.com>
# Date: 03/17/2008
# Purpose: Set up circular cluster replication where each
# cluster has two mysqlds and replication directions are
# following:
# master ---> slave
# / \
# cluster A cluster B
# \ /
# master1 <--- slave1
#############################################################
--source include/have_log_bin.inc
# Make connections to mysqlds
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT1,);
connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT1,);
# Check that all mysqld compiled with ndb support
--connection master
--disable_query_log
--require r/true.require
SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster';
--source include/ndb_not_readonly.inc
--enable_query_log
--connection master1
--disable_query_log
--require r/true.require
SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster';
--source include/ndb_not_readonly.inc
--enable_query_log
--connection slave
--disable_query_log
--require r/true.require
SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster';
--source include/ndb_not_readonly.inc
--enable_query_log
--connection slave1
--disable_query_log
--require r/true.require
SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster';
--source include/ndb_not_readonly.inc
--enable_query_log
# Stop slaves
--connection master
--disable_warnings
STOP SLAVE;
--wait_for_slave_to_stop
--enable_warnings
--connection master1
--disable_warnings
STOP SLAVE;
--wait_for_slave_to_stop
--enable_warnings
--connection slave
--disable_warnings
STOP SLAVE;
--wait_for_slave_to_stop
--enable_warnings
--connection slave1
--disable_warnings
STOP SLAVE;
--wait_for_slave_to_stop
--enable_warnings
# Reset masters
--connection master
--disable_warnings
--disable_query_log
USE test;
--enable_query_log
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
--enable_warnings
RESET MASTER;
--connection master1
--disable_warnings
--disable_query_log
USE test;
--enable_query_log
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
--enable_warnings
RESET MASTER;
--connection slave
--disable_warnings
--disable_query_log
USE test;
--enable_query_log
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
--enable_warnings
RESET MASTER;
--connection slave1
--disable_warnings
--disable_query_log
USE test;
--enable_query_log
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
--enable_warnings
RESET MASTER;
# Start slaves
--connection slave
RESET SLAVE;
--replace_result $MASTER_MYPORT MASTER_MYPORT
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$MASTER_MYPORT,master_user='root'
START SLAVE;
--source include/wait_for_slave_to_start.inc
--connection master1
RESET SLAVE;
--replace_result $SLAVE_MYPORT1 SLAVE_MYPORT1
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT1,master_user='root'
START SLAVE;
--source include/wait_for_slave_to_start.inc
# Set the default connection to 'master' (cluster A)
connection master;
|