スキーマ名またはテーブル名が異なるテーブルのデータチェック

TiDBデータ移行などのレプリケーションツールを使用する場合は、 route-rulesを設定して、ダウンストリームの指定されたテーブルにデータをレプリケートできます。 sync-diff-inspectorを使用すると、 rulesを設定することにより、異なるスキーマ名またはテーブル名を持つテーブルを検証できます。

以下は簡単な設定例です。完全な構成については、 Sync-diff-inspectorユーザーガイドを参照してください。

######################### Datasource config ######################### [data-sources.mysql1] host = "127.0.0.1" port = 3306 user = "root" password = "" route-rules = ["rule1"] [data-sources.tidb0] host = "127.0.0.1" port = 4000 user = "root" password = "" ########################### Routes ########################### [routes.rule1] schema-pattern = "test_1" # Matches the schema name of the data source. Supports the wildcards "*" and "?" table-pattern = "t_1" # Matches the table name of the data source. Supports the wildcards "*" and "?" target-schema = "test_2" # The name of the schema in the target database target-table = "t_2" # The name of the target table

この構成を使用して、ダウンストリームでtest_2.t_2をチェックし、 mysql1インスタンスでtest_1.t_1をチェックできます。

スキーマ名またはテーブル名が異なる多数のテーブルをチェックするには、 rulesを使用してマッピング関係を設定することにより、構成を簡略化できます。スキーマまたはテーブル、あるいはその両方のマッピング関係を構成できます。たとえば、アップストリームtest_1データベースのすべてのテーブルがダウンストリームtest_2データベースに複製されます。これは、次の構成で確認できます。

######################### Datasource config ######################### [data-sources.mysql1] host = "127.0.0.1" port = 3306 user = "root" password = "" route-rules = ["rule1"] [data-sources.tidb0] host = "127.0.0.1" port = 4000 user = "root" password = "" ########################### Routes ########################### [routes.rule1] schema-pattern = "test_1" # Matches the schema name of the data source. Supports the wildcards "*" and "?" table-pattern = "*" # Matches the table name of the data source. Supports the wildcards "*" and "?" target-schema = "test_2" # The name of the schema in the target database target-table = "t_2" # The name of the target table

ノート

test_2の場合。 t_2はアップストリームデータベースに存在し、ダウンストリームデータベースもこのテーブルを比較します。

このページは役に立ちましたか?

Playground
新規
登録なしで TiDB の機能をワンストップでインタラクティブに体験できます。
製品
TiDB Cloud
TiDB
価格
PoC お問い合わせ
エコシステム
TiKV
TiFlash
OSS Insight
© 2024 PingCAP. All Rights Reserved.
Privacy Policy.