Pt-table-checksums monitoring MySQL master-slave data consistency

Source: Internet
Author: User
Tags dsn percona

Official website: https://www.percona.com/doc/percona-toolkit/2.1/pt-table-checksum.html#dsn-options

Environment
Master: 10.50.12.33
From: 10.50.12.35
Simulation **************************************** of master-slave difference phenomenon
Main:
mysql> CREATE DATABASE Gaoquan;
mysql> use Gaoquan;
mysql> CREATE TABLE t1 (id int PRIMARY KEY NOT null auto_increment,name varchar (TEN), age int);
mysql> INSERT INTO T1 (name,age) VALUES (' a ', ' + '), (' B ', +), (' C ', 34);

From:
Mysql> Use Gaoquan
mysql> Delete from T1 where name= ' a ';
Master-Slave data difference check ********************************************
Main operation:
Mysql-s/tmp/mysql3336.sock
##### #创建cheksums账号
Mysql> GRANT SELECT, PROCESS, SUPER, REPLICATION SLAVE on * * to ' checksums ' @ ' 10.50.12.% ' identified by ' checksums ';
##### #创建从库信息表dsns
mysql> use test;
Mysql> CREATE TABLE DSNs (ID int (one) not null auto_increment,parent_id int (one) default NULL,DSN varchar (255) Not NULL,PR Imary key (ID));
##### #将从库信息插入dsns表中, insert multiple records from
Mysql> INSERT into DSNs (PARENT_ID,DSN) VALUES (1, ' h=10.50.12.35,u=checksums,p=checksums,p=3336 ');
##### #下载pt-tools Tools
wget percona.com/get/percona-toolkit.tar.gz
TAR-ZXF percona-toolkit.tar.gz
CD Percona-toolkit/bin
##### #执行校验
./pt-table-checksum--nocheck-replication-filters--replicate=test.checksums--host=10.50.12.33--port 3336-- Databases=gaoquan-uchecksums-pchecksums--no-check-binlog-format--recursion-method=dsn=h=10.50.12.33,d=test,t= DSNs
##### #结果查询, THIS_CRC! = MASTER_CRC, indicating a difference in master-slave data
Mysql-h 10.50.12.35-uchecksums-p3336-p-E "select * from Test.checksums"
+---------+-----+-------+------------+-------------+----------------+----------------+----------+----------+--- ---------+------------+---------------------+
| db | TBL | Chunk | Chunk_time | Chunk_index | Lower_boundary | Upper_boundary | THIS_CRC | this_cnt | MASTER_CRC | master_cnt | ts |
+---------+-----+-------+------------+-------------+----------------+----------------+----------+----------+--- ---------+------------+---------------------+
| Gaoquan |     T1 |   1 | 0.001375 | NULL | NULL | NULL |        afa2742d | 3 |          9cf2c2d4 | 4 | 2015-12-25 16:17:35 |
+---------+-----+-------+------------+-------------+----------------+----------------+----------+----------+--- ---------+------------+---------------------+



Pt-table-checksums monitoring MySQL master-slave data consistency

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.