Get the App
SLTechnology News&Howtos  ›  Database  › 

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

Shulou Source: shulou.com Published: 2022-06-01 06:58:10 11月13日 Update

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

Tags: Information master-slave difference data background reference difference consistency consistency port Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn OPPO Reno Linux Xiaomi NVidia