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

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.