连接到slave上,执行同步master上的数据操作
[root@centos-1 bin]# ./pt-table-sync --execute --sync-to-master h='127.0.0.1',u='root',p='dh123',P=5331 -d db1 --verbose
# Syncing P=5331,h=127.0.0.1,p=...,u=root
# DELETE REPLACE INSERT UPDATE ALGORITHM START END EXIT DATABASE.TABLE
# 0 0 0 0 Chunk 14:04:31 14:04:31 0 db1.tab1_1
# 0 1000 0 0 Chunk 14:04:31 14:04:32 2 db1.tab1_2
重新执行checksum,可以看到数据已经同步过来了。
SELECT db, tbl,lower_boundary,upper_boundary, this_cnt,master_cnt,this_crc,master_crc,ts FROM test.checksums ;
+-----+--------+----------------+----------------+----------+------------+----------+------------+---------------------+
| db | tbl | lower_boundary | upper_boundary | this_cnt | master_cnt | this_crc | master_crc | ts |
+-----+--------+----------------+----------------+----------+------------+----------+------------+---------------------+
| db1 | tab1_1 | 0 | 999 | 1000 | 1000 | dbd114dd | dbd114dd | 2013-06-25 14:06:38 |
| db1 | tab1_1 | 1000 | 9999 | 9000 | 9000 | 0 | 0 | 2013-06-25 14:06:38 |
| db1 | tab1_1 | NULL | 0 | 0 | 0 | 0 | 0 | 2013-06-25 14:06:38 |
| db1 | tab1_1 | 9999 | NULL | 0 | 0 | 0 | 0 | 2013-06-25 14:06:38 |
| db1 | tab1_2 | NULL | NULL | 1000 | 1000 | dbd114dd | dbd114dd | 2013-06-25 14:06:38 |
+-----+--------+----------------+----------------+----------+------------+----------+------------+---------------------+