@@ -6,9 +6,11 @@ summary: sync-diff-inspector 是一个用于校验 MySQL/TiDB 中数据一致性
66
77# sync-diff-inspector 用户文档
88
9- [ sync-diff-inspector] ( https://github.com/pingcap/tidb-tools /tree/master/sync_diff_inspector ) 是一个用于校验 MySQL/TiDB 中两份数据是否一致的工具。该工具提供了修复数据的功能(适用于修复少量不一致的数据)。
9+ [ sync-diff-inspector] ( https://github.com/pingcap/tiflow /tree/master/sync_diff_inspector ) 是一个用于校验 MySQL/TiDB 中两份数据是否一致的工具。该工具提供了修复数据的功能(适用于修复少量不一致的数据)。
1010
11- 主要功能:
11+ 本文介绍 sync-diff-inspector 的主要功能,并说明如何配置以及使用该工具。
12+
13+ ## 主要功能
1214
1315* 对比表结构和数据
1416* 如果数据不一致,则生成用于修复数据的 SQL 语句
@@ -17,12 +19,31 @@ summary: sync-diff-inspector 是一个用于校验 MySQL/TiDB 中数据一致性
1719* 支持 [ TiDB 主从集群的数据校验] ( /ticdc/ticdc-upstream-downstream-check.md )
1820* 支持[ 从 TiDB DM 拉取配置的数据校验] ( /sync-diff-inspector/dm-diff.md )
1921
20- 你可通过以下方式下载 sync-diff-inspector:
22+ ## 安装 sync-diff-inspector
23+
24+ sync-diff-inspector 的安装方法取决于 TiDB 版本。
25+
26+ 对于 TiDB v9.0.0 及以上版本,你可通过以下方式下载 sync-diff-inspector:
27+
28+ + 使用 TiUP 安装:
29+
30+ ``` shell
31+ tiup install sync-diff-inspector
32+ ```
33+
34+ + 下载 Binary 包。sync-diff-inspector 的安装包位于 TiDB 离线工具包中。下载方式,请参考 [TiDB 工具下载](/download-ecosystem-tools.md)。
35+
36+ + 使用 Docker 镜像。执行以下命令进行下载:
2137
22- + Binary 包。sync-diff-inspector 的安装包位于 TiDB 离线工具包中。下载方式,请参考 [ TiDB 工具下载] ( /download-ecosystem-tools.md ) 。
23- + Docker 镜像。执行以下命令进行下载:
38+ ` ` ` shell
39+ docker pull pingcap/sync-diff-inspector:latest
40+ ` ` `
2441
25- {{< copyable "shell-regular" >}}
42+ 对于 TiDB v9.0.0 之前版本,你可通过以下方式下载 sync-diff-inspector:
43+
44+ + 下载来自 [` tidb-tools` ](https://github.com/pingcap/tidb-tools) 仓库的 Binary 包。sync-diff-inspector 的安装包位于 TiDB 离线工具包中。下载方式,请参考 [TiDB 工具下载](/download-ecosystem-tools.md)。
45+
46+ + 使用 Docker 镜像。执行以下命令进行下载:
2647
2748 ` ` ` shell
2849 docker pull pingcap/tidb-tools:latest
@@ -287,15 +308,13 @@ Average Speed: 113.277149MB/s
287308- 下游数据库冗余行,则是 DELETE 语句
288309- 下游数据库行部分数据不一致,则是 REPLACE 语句,但会在 SQL 文件中通过注释的方法标明不同的列
289310
290- ```SQL
311+ ```sql
291312-- table: sbtest.sbtest99
292313-- range in sequence: (3690708) < (id) <= (3720581)
293314/*
294315 DIFF COLUMNS ╏ `K` ╏ `C` ╏ `PAD`
295316╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╋╍╍╍╍╍╍╍╍╍╋╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╋╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍
296317 source data ╏ 2501808 ╏ 'hello' ╏ 'world'
297- ╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╋╍╍╍╍╍╍╍╍╍╋╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╋╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍
298- target data ╏ 5003616 ╏ '0709824117-9809973320-4456050422' ╏ '1714066100-7057807621-1425865505'
299318╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╋╍╍╍╍╍╍╍╍╍╋╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╋╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍
300319*/
301320REPLACE INTO `sbtest`.`sbtest99`(`id`,`k`,`c`,`pad`) VALUES (3700000,2501808,'hello','world');
0 commit comments