Sign InTry Free

Data Check for TiDB Upstream and Downstream Clusters

You can use TiDB Binlog to build upstream and downstream clusters of TiDB. When Drainer replicates data to TiDB, the checkpoint is saved and the TSO mapping relationship between the upstream and downstream is also saved as ts-map. To check data between the upstream and downstream, configure snapshot in sync-diff-inspector.

Step 1: obtain ts-map

To obtain ts-map, execute the following SQL statement in the downstream TiDB cluster:

mysql> select * from tidb_binlog.checkpoint; +---------------------+---------------------------------------------------------------------------------------------------------+ | clusterID | checkPoint | +---------------------+---------------------------------------------------------------------------------------------------------+ | 6711243465327639221 | {"commitTS":409622383615541249,"ts-map":{"primary-ts":409621863377928194,"secondary-ts":409621863377928345}} | +---------------------+---------------------------------------------------------------------------------------------------------+

Step 2: configure snapshot

Then configure the snapshot information of the upstream and downstream databases by using the ts-map information obtained in Step 1.

Here is a configuration example of the Datasource config section:

######################### Datasource config ######################## [data-sources.mysql1] host = "127.0.0.1" port = 3306 user = "root" password = "" snapshot = "409621863377928345" [data-sources.tidb0] host = "127.0.0.1" port = 4000 user = "root" snapshot = "409621863377928345"
Download PDF
Playground
One-stop & interactive experience of TiDB's capabilities WITHOUT registration.
Products
TiDB
TiDB Dedicated
TiDB Serverless
Pricing
Get Demo
Get Started
© 2024 PingCAP. All Rights Reserved.
Privacy Policy.