mysql 备份 一致性 pt_【MySQL】验证数据库复制一致性:pt-table-checksum

[root@wallet01 ~]# wget https://repo.percona.com/yum/percona-release-latest.noarch.rpm

[root@wallet01 ~]# rpm -ivh percona-release-latest.noarch.rpm

[root@wallet01 ~]# yum install -y percona-toolkit

[root@wallet01 ~]# pt-table-checksum --version

pt-table-checksum 3.0.13

[root@wallet01 ~]# pt-table-checksum --user=root --ask-pass --host=192.168.1.201 --port=3306 --databases=soe \

--replicate=soe.checksums --nocheck-replication-filters --nocheck-binlog-format

Enter MySQL password:

Checking if all tables can be checksummed ...

Starting checksum ...

TS ERRORS  DIFFS     ROWS  DIFF_ROWS  CHUNKS SKIPPED    TIME TABLE

02-18T14:45:35      0      0   300000          0       9       0   3.024 soe.customer

02-18T14:45:35      0      0      100          0       1       0   0.149 soe.district

02-18T14:45:35      0      0        1          0       1       0   0.148 soe.heartbeat

02-18T14:45:37      0      0   340588          0       5       0   1.942 soe.history

02-18T14:45:37      0      0   100000          0       1       0   0.457 soe.item

02-18T14:45:38      0      0    89670          0       1       0   0.279 soe.new_orders

02-18T14:45:49      0      0  3403055          0      20       0  11.224 soe.order_line

02-18T14:45:50      0      0   340179          0       1       0   1.076 soe.orders

02-18T14:45:57      0      0  1000000          0      11       0   6.767 soe.stock

02-18T14:45:57      0      0       10          0       1       0   0.142 soe.warehouse

[root@wallet02 ~]# mysql -uroot -pabcd.1234

mysql> use soe

Database changed

mysql>  set foreign_key_checks=0;

Query OK, 0 rows affected (0.00 sec)

mysql> delete from customer where c_id=1 and c_d_id=1 and c_w_id=1;

Query OK, 1 row affected (0.07 sec)

[root@wallet01 ~]# pt-table-checksum --user=root --ask-pass --host=192.168.1.201 --port=3306 --databases=soe \

--replicate=soe.checksums --nocheck-replication-filters --nocheck-binlog-format

Enter MySQL password:

Checking if all tables can be checksummed ...

Starting checksum ...

TS ERRORS  DIFFS     ROWS  DIFF_ROWS  CHUNKS SKIPPED    TIME TABLE

02-18T14:49:22      0      1   300000          0       9       0   3.065 soe.customer

02-18T14:49:22      0      0      100          0       1       0   0.143 soe.district

02-18T14:49:22      0      0        1          0       1       0   0.137 soe.heartbeat

02-18T14:49:24      0      0   340579          0       5       0   1.930 soe.history

02-18T14:49:25      0      0   100000          0       1       0   0.440 soe.item

02-18T14:49:25      0      0    89670          0       1       0   0.239 soe.new_orders

02-18T14:49:37      0      0  3403055          0      20       0  11.451 soe.order_line

02-18T14:49:38      0      0   340179          0       1       0   1.056 soe.orders

02-18T14:49:44      0      0  1000000          0      11       0   6.246 soe.stock

02-18T14:49:44      0      0       10          0       1       0   0.146 soe.warehouse

[root@wallet01 ~]# pt-table-sync --print --replicate=soe.checksums h=192.168.1.201,u=root,p=abcd.1234 \

h=192.168.1.202,u=root,p=abcd.1234

REPLACE INTO `soe`.`customer`(`c_id`, `c_d_id`, `c_w_id`, `c_first`, `c_middle`, `c_last`, `c_street_1`, `c_street_2`, `c_city`,

`c_state`, `c_zip`, `c_phone`, `c_since`, `c_credit`, `c_credit_lim`, `c_discount`, `c_balance`, `c_ytd_payment`, `c_payment_cnt`,

`c_delivery_cnt`, `c_data`) VALUES ('1', '1', '1', 'rfpXdvRGZ78lsPR', 'OE', 'BARBARBAR', 'sE74yrapn1A5mn7bRw64', 'VIPbPATmZLe',

'TikIJZ3Ii83T', 'cu', '582037381', '6083691478835012', '2019-02-18 10:28:52', 'GC', '50000', '0.17', '-10.00', '10.00', '1', '0',

'GtbAtoNGbznqOtSPmT6Om5Y9MQfemMW0F886uWMTV9Jr0lEmCL9zQh8m6lOs7sqKyyQsUkKyrdnsN2eZNlYnThXZQtPYjDsi9HYc1satWNlrPNQk7xVac072tWadhRJqgrS

hi0YCMH3jfRUmOxK0yR1pvZSa0jQeZrMHpuTBCUvpvNZIKrGGGH69rWjpG7Upyo6ogXxq1qduDCCW1TmHiqOXN7NdFpSBdWxH1v80lluxw5RxWBDE2bmPh72wwS5Xw3oxyux

hgpecu3XQFidHKPe1UevO4yv01hvxcqfGfHsaLNyY6bpOyRPS5Iq9Ej7GP2BzsoFX655PS2xYdkwaBJ2EZrLoYS2vUBuK07p4CtTdvO9W866HN7VvwqhUGhOisI2qQpuaiND

blN8rRE8mJ') /*percona-toolkit src_db:soe src_tbl:customer src_dsn:h=192.168.40.34,p=...,u=root dst_db:soe dst_tbl:customer

dst_dsn:h=wallet02,p=...,u=root lock:1 transaction:1 changing_src:soe.checksums replicate:soe.checksums bidirectional:0

pid:2396 user:root host:wallet01*/;

[root@wallet01 ~]# pt-table-sync --execute --replicate=soe.checksums h=192.168.1.201,u=root,p=abcd.1234 \

h=192.168.1.202,u=root,p=abcd.1234 --noforeign-key-checks

[root@wallet01 ~]# pt-table-checksum --user=root --ask-pass --host=192.168.1.201 --port=3306 --databases=soe \

--replicate=soe.checksums --nocheck-replication-filters --nocheck-binlog-format

Enter MySQL password:

Checking if all tables can be checksummed ...

Starting checksum ...

TS ERRORS  DIFFS     ROWS  DIFF_ROWS  CHUNKS SKIPPED    TIME TABLE

02-18T14:56:31      0      0   300000          0       9       0   2.950 soe.customer

02-18T14:56:31      0      0      100          0       1       0   0.139 soe.district

02-18T14:56:31      0      0        1          0       1       0   0.151 soe.heartbeat

02-18T14:56:33      0      0   340579          0       5       0   1.933 soe.history

02-18T14:56:34      0      0   100000          0       1       0   0.532 soe.item

02-18T14:56:34      0      0    89670          0       1       0   0.250 soe.new_orders

02-18T14:56:45      0      0  3403055          0      20       0  11.300 soe.order_line

02-18T14:56:46      0      0   340179          0       1       0   1.058 soe.orders

02-18T14:56:53      0      0  1000000          0      12       0   6.821 soe.stock

02-18T14:56:53      0      0       10          0       1       0   0.147 soe.warehouse

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值