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 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
|
RESET MASTER;
connect slave,127.0.0.1,root,,,$SERVER_MYPORT_3;
change master to relay_log_file='' for channel 'abc1';
ERROR HY000: Failed initializing relay log position: Could not find target log during relay log initialization
change master to master_host='' for channel 'abc2';
ERROR HY000: Incorrect arguments to MASTER_HOST
change master to
master_port=MYPORT_1,
master_host='127.0.0.1',
master_user='root', master_ssl_verify_server_cert=0,
master_use_gtid=no
for channel 'master1';
start slave for channel 'master1';
set default_master_connection = 'master1';
include/wait_for_slave_to_start.inc
connect master1,127.0.0.1,root,,,$SERVER_MYPORT_1;
connection slave;
#
# Checking SHOW SLAVE 'master1' STATUS
#
Master_Port = 'MYPORT_1'
Relay_Log_File = 'mysqld-relay-bin-master1.000002'
Slave_IO_Running = 'Yes'
Slave_SQL_Running = 'Yes'
Last_Errno = '0'
Last_SQL_Errno = '0'
#
# Checking SHOW SLAVE STATUS
#
Master_Port = 'MYPORT_1'
Relay_Log_File = 'mysqld-relay-bin-master1.000002'
Slave_IO_Running = 'Yes'
Slave_SQL_Running = 'Yes'
Last_Errno = '0'
Last_SQL_Errno = '0'
#
# Checking SHOW ALL SLAVES STATUS
#
Connection_name = 'master1'
Master_Port = 'MYPORT_1'
Relay_Log_File = 'mysqld-relay-bin-master1.000002'
Slave_IO_Running = 'Yes'
Slave_SQL_Running = 'Yes'
Last_Errno = '0'
Last_SQL_Errno = '0'
Slave_heartbeat_period = '60.000'
#
connection master1;
drop database if exists db1;
create database db1;
use db1;
create table t1 (i int auto_increment, f1 varchar(16), primary key pk (i,f1)) engine=MyISAM;
Warnings:
Warning 1280 Name 'pk' ignored for PRIMARY key.
insert into t1 (f1) values ('one'),('two');
connection slave;
select * from db1.t1;
i f1
1 one
2 two
# List of relay log files in the datadir
mysqld-relay-bin-master1.000001
mysqld-relay-bin-master1.000002
mysqld-relay-bin-master1.index
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
mysqld-relay-bin-master1.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
mysqld-relay-bin-master1.000001 # Rotate # # mysqld-relay-bin-master1.000002;pos=4
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
mysqld-relay-bin-master1.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
mysqld-relay-bin-master1.000002 # Rotate # # master-bin.000001;pos=POS
mysqld-relay-bin-master1.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
mysqld-relay-bin-master1.000002 # Gtid_list # # []
mysqld-relay-bin-master1.000002 # Binlog_checkpoint # # master-bin.000001
mysqld-relay-bin-master1.000002 # Gtid # # GTID #-#-#
mysqld-relay-bin-master1.000002 # Query # # drop database if exists db1
mysqld-relay-bin-master1.000002 # Gtid # # GTID #-#-#
mysqld-relay-bin-master1.000002 # Query # # create database db1
mysqld-relay-bin-master1.000002 # Gtid # # GTID #-#-#
mysqld-relay-bin-master1.000002 # Query # # use `db1`; create table t1 (i int auto_increment, f1 varchar(16), primary key pk (i,f1)) engine=MyISAM
mysqld-relay-bin-master1.000002 # Gtid # # BEGIN GTID #-#-#
mysqld-relay-bin-master1.000002 # Intvar # # INSERT_ID=1
mysqld-relay-bin-master1.000002 # Query # # use `db1`; insert into t1 (f1) values ('one'),('two')
mysqld-relay-bin-master1.000002 # Query # # COMMIT
change master to
master_port=MYPORT_2,
master_host='127.0.0.1',
master_user='root'
for channel 'master1';
ERROR HY000: This operation cannot be performed as you have a running slave 'master1'; run STOP SLAVE 'master1' first
change master to
master_port=MYPORT_2,
master_host='127.0.0.1',
master_user='root';
ERROR HY000: This operation cannot be performed as you have a running slave 'master1'; run STOP SLAVE 'master1' first
change master to
master_port=MYPORT_1,
master_host='127.0.0.1',
master_user='root' for channel 'master2';
ERROR HY000: Connection 'master2' conflicts with existing connection 'master1'
set default_master_connection = '';
change master to
master_port=MYPORT_2,
master_host='127.0.0.1',
master_user='root', master_ssl_verify_server_cert=0,
master_use_gtid=no;
start slave;
include/wait_for_slave_to_start.inc
#
# Checking SHOW ALL SLAVES STATUS
#
Connection_name = ''
Connection_name = 'master1'
Master_Port = 'MYPORT_2'
Master_Port = 'MYPORT_1'
Relay_Log_File = 'mysqld-relay-bin.000002'
Relay_Log_File = 'mysqld-relay-bin-master1.000002'
Slave_IO_Running = 'Yes'
Slave_IO_Running = 'Yes'
Slave_SQL_Running = 'Yes'
Slave_SQL_Running = 'Yes'
Last_Errno = '0'
Last_Errno = '0'
Last_SQL_Errno = '0'
Last_SQL_Errno = '0'
Slave_heartbeat_period = '60.000'
Slave_heartbeat_period = '60.000'
#
connection master1;
insert into t1 (f1) values ('three');
connect master2,127.0.0.1,root,,,$SERVER_MYPORT_2;
drop database if exists db2;
create database db2;
use db2;
create table t1 (pk int auto_increment primary key, f1 int) engine=InnoDB;
begin;
insert into t1 (f1) values (1),(2);
connection slave;
connection master2;
connection slave;
select * from db1.t1;
i f1
1 one
2 two
3 three
select * from db2.t1;
pk f1
connection master2;
commit;
connection slave;
select * from db2.t1;
pk f1
1 1
2 2
connection master1;
flush logs;
connection slave;
connection master1;
purge binary logs to 'master-bin.000002';
show binary logs;
Log_name File_size
master-bin.000002 filesize
insert into t1 (f1) values ('four');
create table db1.t3 (f1 int) engine=InnoDB;
connection slave;
#
# Checking SHOW ALL SLAVES STATUS
#
Connection_name = ''
Connection_name = 'master1'
Master_Port = 'MYPORT_2'
Master_Port = 'MYPORT_1'
Relay_Log_File = 'mysqld-relay-bin.000002'
Relay_Log_File = 'mysqld-relay-bin-master1.000004'
Slave_IO_Running = 'Yes'
Slave_IO_Running = 'Yes'
Slave_SQL_Running = 'Yes'
Slave_SQL_Running = 'Yes'
Last_Errno = '0'
Last_Errno = '0'
Last_SQL_Errno = '0'
Last_SQL_Errno = '0'
Slave_heartbeat_period = '60.000'
Slave_heartbeat_period = '60.000'
#
#
# MDEV:16437: merge 5.7 P_S replication instrumentation and tables
#
SELECT * FROM performance_schema.replication_applier_status_by_coordinator;
CHANNEL_NAME master1
THREAD_ID #
SERVICE_STATE ON
LAST_ERROR_NUMBER 0
LAST_ERROR_MESSAGE
LAST_ERROR_TIMESTAMP 0000-00-00 00:00:00
LAST_SEEN_TRANSACTION 0-1-7
LAST_TRANS_RETRY_COUNT 0
CHANNEL_NAME
THREAD_ID #
SERVICE_STATE ON
LAST_ERROR_NUMBER 0
LAST_ERROR_MESSAGE
LAST_ERROR_TIMESTAMP 0000-00-00 00:00:00
LAST_SEEN_TRANSACTION 0-2-4
LAST_TRANS_RETRY_COUNT 0
select * from db1.t1;
i f1
1 one
2 two
3 three
4 four
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
mysqld-relay-bin.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
mysqld-relay-bin.000001 # Rotate # # mysqld-relay-bin.000002;pos=4
include/show_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
mysqld-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
mysqld-relay-bin.000002 # Rotate # # master-bin.000001;pos=POS
mysqld-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
mysqld-relay-bin.000002 # Gtid_list # # []
mysqld-relay-bin.000002 # Binlog_checkpoint # # master-bin.000001
mysqld-relay-bin.000002 # Gtid # # GTID #-#-#
mysqld-relay-bin.000002 # Query # # drop database if exists db2
mysqld-relay-bin.000002 # Gtid # # GTID #-#-#
mysqld-relay-bin.000002 # Query # # create database db2
mysqld-relay-bin.000002 # Gtid # # GTID #-#-#
mysqld-relay-bin.000002 # Query # # use `db2`; create table t1 (pk int auto_increment primary key, f1 int) engine=InnoDB
mysqld-relay-bin.000002 # Gtid # # BEGIN GTID #-#-#
mysqld-relay-bin.000002 # Intvar # # INSERT_ID=1
mysqld-relay-bin.000002 # Query # # use `db2`; insert into t1 (f1) values (1),(2)
mysqld-relay-bin.000002 # Xid # # COMMIT /* XID */
disconnect slave;
connect slave,127.0.0.1,root,,,$SERVER_MYPORT_3;
stop slave io_thread;
show status like 'Slave_running';
Variable_name Value
Slave_running OFF
set default_master_connection = 'master1';
show status like 'Slave_running';
Variable_name Value
Slave_running ON
#
# syntax compatible test
#
#
# show relaylog events
#
SHOW RELAYLOG EVENTS for channel 'master1';
Log_name Pos Event_type Server_id End_log_pos Info
mysqld-relay-bin-master1.000003 4 Format_desc 3 256 Server ver: Version
mysqld-relay-bin-master1.000003 256 Rotate 1 1358 master-bin.000002;pos=4
mysqld-relay-bin-master1.000003 304 Rotate 3 366 mysqld-relay-bin-master1.000004;pos=4
show slave status for channel 'master1'
Master_Port = 'MYPORT_1'
Relay_Log_File = 'mysqld-relay-bin-master1.000004'
Slave_IO_Running = 'Yes'
Slave_SQL_Running = 'Yes'
Last_Errno = '0'
Last_SQL_Errno = '0'
#
# stop slave
#
STOP SLAVE for channel 'master1';
show slave status for channel 'master1'
Master_Port = 'MYPORT_1'
Relay_Log_File = 'mysqld-relay-bin-master1.000004'
Slave_IO_Running = 'No'
Slave_SQL_Running = 'No'
Last_Errno = '0'
Last_SQL_Errno = '0'
#
# start slave
#
START SLAVE for channel 'master1';
include/wait_for_slave_to_start.inc
connection master1;
create table foo (a int);
drop table foo;
connection slave;
show slave status for channel 'master1'
Master_Port = 'MYPORT_1'
Relay_Log_File = 'mysqld-relay-bin-master1.000005'
Slave_IO_Running = 'Yes'
Slave_SQL_Running = 'Yes'
Last_Errno = '0'
Last_SQL_Errno = '0'
#
# flush relay logs
#
FLUSH RELAY LOGS for channel 'master1';
show slave status for channel 'master1'
Master_Port = 'MYPORT_1'
Relay_Log_File = 'mysqld-relay-bin-master1.000006'
Slave_IO_Running = 'Yes'
Slave_SQL_Running = 'Yes'
Last_Errno = '0'
Last_SQL_Errno = '0'
#
# stop slave
#
STOP SLAVE for channel 'master1';
show slave status for channel 'master1'
Master_Port = 'MYPORT_1'
Relay_Log_File = 'mysqld-relay-bin-master1.000006'
Slave_IO_Running = 'No'
Slave_SQL_Running = 'No'
Last_Errno = '0'
Last_SQL_Errno = '0'
#
# reset slave
#
RESET SLAVE for channel 'master1';
Warnings:
Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
show slave status for channel 'master1'
Master_Port = 'MYPORT_1'
Relay_Log_File = ''
Slave_IO_Running = 'No'
Slave_SQL_Running = 'No'
Last_Errno = '0'
Last_SQL_Errno = '0'
#
# show relaylog events after reset slave
#
SHOW RELAYLOG EVENTS for channel 'master1';
Log_name Pos Event_type Server_id End_log_pos Info
#
# check error syntax
#
RESET SLAVE 'master1' for channel 'mmaster2';
ERROR HY000: Incorrect arguments to CONNECTION_NAME AND FOR CHANNEL CAN NOT BE SPECIFIED AT THE SAME TIME)
STOP SLAVE 'master1' for channel 'master2';
ERROR HY000: Incorrect arguments to CONNECTION_NAME AND FOR CHANNEL CAN NOT BE SPECIFIED AT THE SAME TIME)
FLUSH RELAY LOGS 'master1' for channel 'master2';
ERROR HY000: Incorrect arguments to CONNECTION_NAME AND FOR CHANNEL CAN NOT BE SPECIFIED AT THE SAME TIME)
START SLAVE 'master1' for channel 'master2';
ERROR HY000: Incorrect arguments to CONNECTION_NAME AND FOR CHANNEL CAN NOT BE SPECIFIED AT THE SAME TIME)
SHOW RELAYLOG 'master1' EVENTS for channel 'master2';
ERROR HY000: Incorrect arguments to CONNECTION_NAME AND FOR CHANNEL CAN NOT BE SPECIFIED AT THE SAME TIME)
SHOW SLAVE 'master1' STATUS for channel 'master2';
ERROR HY000: Incorrect arguments to CONNECTION_NAME AND FOR CHANNEL CAN NOT BE SPECIFIED AT THE SAME TIME)
drop database db1;
drop database db2;
include/reset_master_slave.inc
disconnect slave;
connection master1;
drop database db1;
include/reset_master_slave.inc
disconnect master1;
connection master2;
drop database db2;
include/reset_master_slave.inc
disconnect master2;
connection default;
CREATE TABLE channel (channel int);
DROP TABLE channel;
|