| 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 |
SET @old_binlog_row_image= @@binlog_row_image; |
| 7 |
[connection slave] |
| 8 |
SET @old_binlog_row_image= @@binlog_row_image; |
| 9 |
[connection master] |
| 10 |
# 1. Initial setup includes setting the transaction isolation level to |
| 11 |
# 'READ-COMMITTED' on master and setting binlog_row_image = FULL using |
| 12 |
# rpl_row_img_set.inc. |
| 13 |
SET @old_transaction_isolation= @@session.transaction_isolation; |
| 14 |
SET SESSION transaction_isolation='READ-COMMITTED'; |
| 15 |
# Set the binlog_row_image to FULL on both master and slave. |
| 16 |
CON: 'master', IMG: 'FULL', RESTART SLAVE: 'N' |
| 17 |
SET SESSION binlog_row_image= 'FULL'; |
| 18 |
SET GLOBAL binlog_row_image= 'FULL'; |
| 19 |
FLUSH TABLES; |
| 20 |
SHOW VARIABLES LIKE 'binlog_row_image'; |
| 21 |
Variable_name Value |
| 22 |
binlog_row_image FULL |
| 23 |
CON: 'slave', IMG: 'FULL', RESTART SLAVE: 'Y' |
| 24 |
SET SESSION binlog_row_image= 'FULL'; |
| 25 |
SET GLOBAL binlog_row_image= 'FULL'; |
| 26 |
include/stop_slave.inc |
| 27 |
include/start_slave.inc |
| 28 |
FLUSH TABLES; |
| 29 |
SHOW VARIABLES LIKE 'binlog_row_image'; |
| 30 |
Variable_name Value |
| 31 |
binlog_row_image FULL |
| 32 |
# |
| 33 |
# 2. Create two tables with same structure and insert a row into a table. |
| 34 |
# |
| 35 |
CREATE DATABASE a; |
| 36 |
CREATE DATABASE b; |
| 37 |
CREATE TABLE a.test (id INT PRIMARY KEY, name VARCHAR(50) DEFAULT NULL, age BIGINT)ENGINE=InnoDB; |
| 38 |
CREATE TABLE b.test (id INT PRIMARY KEY, name VARCHAR(50) DEFAULT NULL, age BIGINT)ENGINE=InnoDB; |
| 39 |
include/sync_slave_sql_with_master.inc |
| 40 |
# |
| 41 |
# 3. Verify that INSERT..SELECT query is logged with full image on both |
| 42 |
# master and slave with the use of rpl_row_img_parts_master_slave.inc |
| 43 |
# file. |
| 44 |
# |
| 45 |
[connection master] |
| 46 |
SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; |
| 47 |
INSERT INTO a.test(id, age) VALUES (1,5); |
| 48 |
SET sql_mode = default; |
| 49 |
SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; |
| 50 |
INSERT INTO b.test(id,age) SELECT id , age FROM a.test; |
| 51 |
SET sql_mode = default; |
| 52 |
DROP DATABASE a; |
| 53 |
DROP DATABASE b; |
| 54 |
include/sync_slave_sql_with_master.inc |
| 55 |
[connection master] |
| 56 |
SET GLOBAL binlog_row_image= @old_binlog_row_image; |
| 57 |
SET SESSION binlog_row_image= @old_binlog_row_image; |
| 58 |
SET SESSION transaction_isolation= @old_transaction_isolation; |
| 59 |
[connection slave] |
| 60 |
SET GLOBAL binlog_row_image= @old_binlog_row_image; |
| 61 |
SET SESSION binlog_row_image= @old_binlog_row_image; |
| 62 |
include/rpl_end.inc |