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
|
include/master-slave.inc
Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
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.
[connection master]
##################################################
# 1. Enable the generation of GIPKs in the source
# Create a table with no primary key
[connection master]
SET SESSION sql_generate_invisible_primary_key = ON;
include/disable_binlog.inc
CREATE TABLE t1(f1 INT, f2 INT);
include/restore_binlog.inc
include/assert.inc [The table contains 3 columns]
include/assert.inc [The table contains a generated invisilble primary key]
##################################################
# 2. Create the same table on the replica
[connection slave]
CREATE TABLE t1(f1 INT, f2 INT);
##################################################
# 3. Insert some values on the table
# Check they are replicated correctly
[connection master]
INSERT INTO t1 VALUES (1, 10);
INSERT INTO t1 VALUES (5, 50);
include/sync_slave_sql_with_master.inc
[connection slave]
include/assert.inc [The table t1 contains the 2 inserted rows]
##################################################
# 4. Update and delete rows in the table
# Check changes are replicated correctly
[connection master]
UPDATE t1 SET t1.f2 = 100 WHERE t1.f1=5;
DELETE FROM t1 WHERE t1.f1=1;
include/sync_slave_sql_with_master.inc
include/assert.inc [The table t1 contains 1 row]
include/assert.inc [The table t1 was updated]
##################################################
# 5. Cleanup
[connection master]
SET SESSION sql_generate_invisible_primary_key = OFF;
DROP TABLE t1;
include/rpl_end.inc
|