pt-table-checksum verification and pt-table-sync repair data
sudo yum install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm yum list | grep percona-toolkit
The result set shows the following to prove that the installation is successful:
percona-toolkit.noarch 3.0.0-rc percona-release-noarch
Then install
sudo yum install percona-toolkit
(2) Unzip the installation package:
[root@localhost home]# cd toolkit/[root@localhost toolkit]# ls percona-toolkit-2.2.19.tar.gz[root@localhost toolkit]# tar -xvf percona-toolkit.tar.gz
So far, percona's toolKit toolkit has been installed. Let's mainly test pt-table-checksum verification and pt-table-sync. The former is mainly used for data verification to verify whether the master and slave are consistent. The latter is mainly used To repair data, the two can generally be used together to repair data inconsistencies.
[root@localhost bin]# /home/toolkit/percona-toolkit-2.2.19/bin/pt-table-checksum --nocheck-replication-filters --replicate=rep_test.checksums --no-check-binlog-format h=172.16.16.35,u=root,p=123456,P=3306TS ERRORS DIFFS ROWS CHUNKS SKIPPED TIME TABLE06-07T10:55:49 0 0 1 1 0 1.331 MAXIANGQIAN.MAXIANGQIAN06-07T10:55:54 0 0 1 1 0 5.524 maxiangqian.test06-07T10:55:56 0 0 4 1 0 1.208 maxiangqian.test0106-07T10:55:57 0 0 0 1 0 1.164 mysql.columns_priv06-07T10:55:58 0 0 5 1 0 1.216 mysql.db06-07T10:55:59 0 0 2 1 0 1.176 mysql.engine_cost06-07T10:56:00 0 0 0 1 0 1.178 mysql.event06-07T10:56:01 0 0 0 1 0 1.160 mysql.func06-07T10:56:03 0 0 1 1 0 1.154 mysql.gtid_executed06-07T10:56:08 0 0 40 4 0 5.015 mysql.help_category06-07T10:56:13 0 0 679 5 0 5.806 mysql.help_keyword06-07T10:56:18 0 0 1334 4 0 4.572 mysql.help_relation06-07T10:56:19 0 0 635 1 0 1.169 mysql.help_topic06-07T10:56:20 0 0 0 1 0 1.163 mysql.ndb_binlog_index06-07T10:56:22 0 0 0 1 0 1.157 mysql.plugin06-07T10:56:23 0 1 48 1 0 1.236 mysql.proc06-07T10:56:24 0 0 0 1 0 1.197 mysql.procs_priv06-07T10:56:25 0 0 1 1 0 1.235 mysql.proxies_priv06-07T10:56:26 0 0 6 1 0 1.188 mysql.server_cost06-07T10:56:28 0 0 0 1 0 1.154 mysql.servers06-07T10:56:34 0 0 1 1 0 6.184 mysql.tables_priv06-07T10:56:35 0 0 0 1 0 1.198 mysql.time_zone06-07T10:56:36 0 0 0 1 0 1.121 mysql.time_zone_leap_second06-07T10:56:37 0 0 0 1 0 1.148 mysql.time_zone_name06-07T10:56:38 0 0 0 1 0 1.147 mysql.time_zone_transition06-07T10:56:40 0 0 0 1 0 1.138 mysql.time_zone_transition_type06-07T10:56:41 0 0 8 1 0 1.336 mysql.user06-07T10:56:42 0 0 0 1 0 1.164 open_api.ma06-07T10:57:01 0 0 1000000 13 0 18.707 sbtest.sbtest06-07T10:57:02 0 0 6 1 0 1.263 sys.sys_config
We can also check a certain library separately to narrow the scope of the check:
[root@localhost bin]# /home/toolkit/percona-toolkit-2.2.19/bin/pt-table-checksum --nocheck-replication-filters --replicate=rep_test.checksums --no-check-binlog-format --databases=maxiangqian h=172.16.16.35,u=root,p=123456,P=3306
The results obtained are as above, take a look at the description :
--nocheck-replication-filters :不检查复制过滤器,建议启用。后面可以用--databases来指定需要检查的数据库。--no-check-binlog-format : 不检查复制的binlog模式,要是binlog模式是ROW,则会报错。--replicate-check-only :只显示不同步的信息。 --replicate= :把checksum的信息写入到指定表中,建议直接写到被检查的数据库当中。 --databases= :指定需要被检查的数据库,多个则用逗号隔开。--tables= :指定需要被检查的表,多个用逗号隔开 h=127.0.0.1 :Master的地址 u=root :用户名 p=123456 :密码 P=3306 :端口
By specifying the --replicate=rep_test.checksums parameter, a database will be automatically generated. The check information All are written to the checksums table.
mysql> select * from checksums where this_cnt<>master_cnt;
Through the above this_crc <> master_crc can more clearly see their inconsistencies. Through chunk, we can know which block of this table has inconsistent records.
[root@localhost bin]# /home/toolkit/percona-toolkit-2.2.19/bin/pt-table-checksum --nocheck-replication-filters --replicate=rep_test.checksums --no-check-binlog-format --databases=maxiangqian h=172.16.16.35,u=root,p=123456,P=3306TS ERRORS DIFFS ROWS CHUNKS SKIPPED TIME TABLE06-07T11:13:18 0 0 1 1 0 1.220 MAXIANGQIAN.MAXIANGQIAN06-07T11:13:19 0 1 1 1 0 1.135 maxiangqian.test06-07T11:13:21 0 0 4 1 0 1.197 maxiangqian.test01
Restore inconsistent data:
[root@localhost bin]# clear[root@localhost bin]# ./pt-table-sync --execute h=172.16.16.35,P=3306,D=maxiangqian,t=test,u=root,p=123456 h=172.16.16.34,P=3306,u=root,p=123456 --no-check-slave --print[root@localhost bin]# /home/toolkit/percona-toolkit-2.2.19/bin/pt-table-checksum --nocheck-replication-filters --replicate=rep_test.checksums --no-check-binlog-format --databases=maxiangqian h=172.16.16.35,u=root,p=123456,P=3306TS ERRORS DIFFS ROWS CHUNKS SKIPPED TIME TABLE06-07T11:18:09 0 0 1 1 0 1.172 MAXIANGQIAN.MAXIANGQIAN06-07T11:18:10 0 0 1 1 0 1.144 maxiangqian.test06-07T11:18:11 0 0 4 1 0 1.282 maxiangqian.test01
itself, the test table is missing a row of data, After execution, the data of the subject and the copy will be consistent:
pt-table-sync --execute h=host1,D=db,t=tbl h=host2[root@localhost bin]# ./pt-table-sync --execute h=172.16.16.35,P=3306,D=maxiangqian,t=test,u=root,p=123456 h=172.16.16.34,P=3306,u=root,p=123456 --no-check-slave --print
(2) Synchronize all data on host1 to host2 and host3
pt-table-sync --execute host1 host2 host3[root@localhost bin]# ./pt-table-sync --execute h=172.16.16.35,P=3306,D=maxiangqian,t=test,u=root,p=123456 h=172.16.16.34,P=3306,u=root,p=123456 h=172.16.16.35,P=3307,u=root,p=123456 --no-check-slave --print
(3) Ensure that all data on slave1 is synchronized with the main database
pt-table-sync --execute --sync-to-master slave1[root@localhost bin]# ./pt-table-sync --execute --sync-to-master h=172.16.16.34,P=3306,u=root,p=123456 --no-check-slave --print
This requirement checks The table must have a primary key or unique index. We can also specify the single table of a single database as follows
[root@localhost bin]# ./pt-table-sync --execute --sync-to-master h=172.16.16.34,P=3306,D=maxiangqian,t=test01,u=root,p=123456 --no-check-slave --print
(4) Restore all slave libraries according to the rep_test.checksums generated by the check
pt-table-sync --execute --replicate test.checksum master1
That is the following example:
[root@localhost bin]# ./pt-table-sync --execute --replicate rep_test.checksums h=172.16.16.35,P=3306,u=root,p=123456
(5) Only repair the data of slave1
/pt-table-sync --execute --replicate rep_test.checksums --sync-to-master slave1
(6) Dual master mode master2 repairs its own data:
pt-table-sync --execute --sync-to-master h=master2,D=db,t=tbl
Due to dual master mode There are many problems. A modification may be transmitted to another database, so we must not perform the following operations in dual-master mode:
pt-table-sync --execute h=master1,D=db,t=tbl master2
The above is the detailed content of pt-table-checksum verification and pt-table-sync repair data. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











When logging into iTunesStore using AppleID, this error saying "This AppleID has not been used in iTunesStore" may be thrown on the screen. There are no error messages to worry about, you can fix them by following these solution sets. Fix 1 – Change Shipping Address The main reason why this prompt appears in iTunes Store is that you don’t have the correct address in your AppleID profile. Step 1 – First, open iPhone Settings on your iPhone. Step 2 – AppleID should be on top of all other settings. So, open it. Step 3 – Once there, open the “Payment & Shipping” option. Step 4 – Verify your access using Face ID. step

DDREASE is a tool for recovering data from file or block devices such as hard drives, SSDs, RAM disks, CDs, DVDs and USB storage devices. It copies data from one block device to another, leaving corrupted data blocks behind and moving only good data blocks. ddreasue is a powerful recovery tool that is fully automated as it does not require any interference during recovery operations. Additionally, thanks to the ddasue map file, it can be stopped and resumed at any time. Other key features of DDREASE are as follows: It does not overwrite recovered data but fills the gaps in case of iterative recovery. However, it can be truncated if the tool is instructed to do so explicitly. Recover data from multiple files or blocks to a single

0.What does this article do? We propose DepthFM: a versatile and fast state-of-the-art generative monocular depth estimation model. In addition to traditional depth estimation tasks, DepthFM also demonstrates state-of-the-art capabilities in downstream tasks such as depth inpainting. DepthFM is efficient and can synthesize depth maps within a few inference steps. Let’s read about this work together ~ 1. Paper information title: DepthFM: FastMonocularDepthEstimationwithFlowMatching Author: MingGui, JohannesS.Fischer, UlrichPrestel, PingchuanMa, Dmytr

A Comprehensive Guide to PHP 500 Errors: Causes, Diagnosis, and Fixes During PHP development, we often encounter errors with HTTP status code 500. This error is usually called "500InternalServerError", which means that some unknown errors occurred while processing the request on the server side. In this article, we will explore the common causes of PHP500 errors, how to diagnose them, and how to fix them, and provide specific code examples for reference. Common causes of 1.500 errors 1.

The performance of JAX, promoted by Google, has surpassed that of Pytorch and TensorFlow in recent benchmark tests, ranking first in 7 indicators. And the test was not done on the TPU with the best JAX performance. Although among developers, Pytorch is still more popular than Tensorflow. But in the future, perhaps more large models will be trained and run based on the JAX platform. Models Recently, the Keras team benchmarked three backends (TensorFlow, JAX, PyTorch) with the native PyTorch implementation and Keras2 with TensorFlow. First, they select a set of mainstream

Facing lag, slow mobile data connection on iPhone? Typically, the strength of cellular internet on your phone depends on several factors such as region, cellular network type, roaming type, etc. There are some things you can do to get a faster, more reliable cellular Internet connection. Fix 1 – Force Restart iPhone Sometimes, force restarting your device just resets a lot of things, including the cellular connection. Step 1 – Just press the volume up key once and release. Next, press the Volume Down key and release it again. Step 2 – The next part of the process is to hold the button on the right side. Let the iPhone finish restarting. Enable cellular data and check network speed. Check again Fix 2 – Change data mode While 5G offers better network speeds, it works better when the signal is weaker

The latest video of Tesla's robot Optimus is released, and it can already work in the factory. At normal speed, it sorts batteries (Tesla's 4680 batteries) like this: The official also released what it looks like at 20x speed - on a small "workstation", picking and picking and picking: This time it is released One of the highlights of the video is that Optimus completes this work in the factory, completely autonomously, without human intervention throughout the process. And from the perspective of Optimus, it can also pick up and place the crooked battery, focusing on automatic error correction: Regarding Optimus's hand, NVIDIA scientist Jim Fan gave a high evaluation: Optimus's hand is the world's five-fingered robot. One of the most dexterous. Its hands are not only tactile

1. Press win+r to open the run window, enter [regedit] and press Enter to open the registry editor. 2. In the opened registry editor, click to expand [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionRun]. In the blank space on the right, right-click and select [New - String Value], and rename it to [systray.exe]. 3. Double-click to open systray.exe, modify its numerical data to [C:WindowsSystem32systray.exe], and click [OK] to save the settings.
