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

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.