pt工具(4)pt-tabke-sync修复主从数据不一致

前提先使用pt-table-checksum,得到checkums,根据checkums这个表定位到不一致的chunk, 对这个chunk切分成多个chunk,一步步定位到不一致的数据

#测试修复命令是否正确
[root@vdb_172_16_123_101 15:55:38 /root]#
shell> pt-table-sync --replicate=percona.checksums h=172.16.123.101,P=3306,u=checksum,p='chk123!@#' --print
REPLACE INTO `db3306`.`t1`(`id`, `name`) VALUES ('3', 'cc') /*percona-toolkit src_db:db3306 src_tbl:t1 src_dsn:P=3306,h=172.16.123.101,p=...,u=checksum dst_db:db3306 dst_tbl:t1 dst_dsn:P=3306,h=vbk_172_16_123_102,p=...,u=checksum lock:1 transaction:1 changing_src:percona.checksums replicate:percona.checksums bidirectional:0 pid:3435 user:root host:vdb_172_16_123_101*/;
DELETE FROM `mysql`.`gtid_executed` WHERE `source_uuid`='fc88a411-1e84-11e7-bdae-00155d01670d' AND `interval_start`='7' LIMIT 1 /*percona-toolkit src_db:mysql src_tbl:gtid_executed src_dsn:P=3306,h=172.16.123.101,p=...,u=checksum dst_db:mysql dst_tbl:gtid_executed dst_dsn:P=3306,h=vbk_172_16_123_102,p=...,u=checksum lock:1 transaction:1 changing_src:percona.checksums replicate:percona.checksums bidirectional:0 pid:3435 user:root host:vdb_172_16_123_101*/;
REPLACE INTO `mysql`.`gtid_executed`(`source_uuid`, `interval_start`, `interval_end`) VALUES ('fc88a411-1e84-11e7-bdae-00155d01670d', '1', '297') /*percona-toolkit src_db:mysql src_tbl:gtid_executed src_dsn:P=3306,h=172.16.123.101,p=...,u=checksum dst_db:mysql dst_tbl:gtid_executed dst_dsn:P=3306,h=vbk_172_16_123_102,p=...,u=checksum lock:1 transaction:1 changing_src:percona.checksums replicate:percona.checksums bidirectional:0 pid:3435 user:root host:vdb_172_16_123_101*/;

#执行修复
[root@vdb_172_16_123_101 15:57:32 /root]#
shell> pt-table-sync --replicate=percona.checksums h=172.16.123.101,P=3306,u=checksum,p='chk123!@#' --execute

[root@vdb_172_16_123_101 15:57:34 /root]#
shell> pt-table-sync --replicate=percona.checksums h=172.16.123.101,P=3306,u=checksum,p='chk123!@#' --print
DELETE FROM `mysql`.`gtid_executed` WHERE `source_uuid`='fc88a411-1e84-11e7-bdae-00155d01670d' AND `interval_start`='7' LIMIT 1 /*percona-toolkit src_db:mysql src_tbl:gtid_executed src_dsn:P=3306,h=172.16.123.101,p=...,u=checksum dst_db:mysql dst_tbl:gtid_executed dst_dsn:P=3306,h=vbk_172_16_123_102,p=...,u=checksum lock:1 transaction:1 changing_src:percona.checksums replicate:percona.checksums bidirectional:0 pid:3452 user:root host:vdb_172_16_123_101*/;
REPLACE INTO `mysql`.`gtid_executed`(`source_uuid`, `interval_start`, `interval_end`) VALUES ('fc88a411-1e84-11e7-bdae-00155d01670d', '1', '297') /*percona-toolkit src_db:mysql src_tbl:gtid_executed src_dsn:P=3306,h=172.16.123.101,p=...,u=checksum dst_db:mysql dst_tbl:gtid_executed dst_dsn:P=3306,h=vbk_172_16_123_102,p=...,u=checksum lock:1 transaction:1 changing_src:percona.checksums replicate:percona.checksums bidirectional:0 pid:3452 user:root host:vdb_172_16_123_101*/;

#再次校验数据是否一致
[root@vdb_172_16_123_101 15:59:28 /root]#
shell> pt-table-checksum --host=172.16.123.101 --port=3306 --user=checksum --password='chk123!@#' --no-check-binlog-format --ignore-databases=mysql
 TS ERRORS DIFFS ROWS CHUNKS SKIPPED TIME TABLE
04-12T15:59:33 0 0 2 1 0 0.029 db3306.t1

 

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇