Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

[Mysql] use pt-table-checksum to check consistency between master and slave different ports

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Background master: 10.32.7.113 3306

From: 10.32.7.112 3307

Step 1: set up tables under the main database of test

CREATE TABLE `dsns` (`id` int (11) NOT NULL AUTO_INCREMENT, `dsn` int (11) DEFAULT NULL, `dsn` varchar (255) NOT NULL, PRIMARY KEY (`id`)); mysql > INSERT INTO dsns (parent_id,dsn) values

Step 2: check the master-slave otter library [root@DB-23 ~] # pt-table-checksum-- nocheck-replication-filters-- no-check-binlog-format-- replicate=test.checksum-- databases=otter upright ptuserptuserptPassfort _ set-vars innodb_lock_wait_timeout=50 10.32.7.113-- empty-replicate-table-- create-replicate-table-- recursion-method=dsn=h=10.32.7.113,D=test,t=dsns-- set-vars innodb_lock_wait_timeout=50

Step3: execute [root@DB-22 ~] # pt-table-sync-- replicate test.checksum-- sync-to-master hobbies 10.32.7.112, Prun3307, from the library.

REPLACE INTO `otter`.`testtab` (`id`) VALUES ('2') / * percona-toolkit src_db:otter src_tbl:testtab src_dsn:P=3306,h=10.32.7.113,p=...,u=ptuser dst_db:otter dst_tbl:testtab dst_dsn:P=3307,h=10.32.7.112,p=...,u=ptuser lock:1 transaction:1 changing_src:test.checksum replicate:test.checksum bidirectional:0 pid:22358 user:root host:DB-22*/

[root@DB-22 ~] # pt-table-sync-- replicate test.checksum-- sync-to-master hobby 10.32.7.112, pamphptpass-- database=otter-- executemysql > select * from testtab

+-- +

| | id |

+-- +

| | 1 |

| | 2 |

+-- +

2 rows in set (0.00 sec)-differential data has been fixed

Reference: http://www.freeoa.net/osuport/db/chk-and-rep-mysql-msprob-by-percona-toolkit_3098.html

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report