> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> BladePipe のデータパイプラインを使用して ClickHouse にデータを取り込みます

# BladePipe を ClickHouse に接続する

export const PartnerBadge = () => {
  return <div className="PartnerBadge">
            <div className="PartnerBadgeIcon">
                <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <polyline points="12.5 9.5 10 12 6 11 2.5 8.5" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1" />
                    <polyline points="4.54 4.41 8 3.5 11.46 4.41" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1" />
                    <path d="M2.15,3.78 L0.55,6.95 A0.5,0.5 0,0,0 0.77,7.62 L2.5,8.5 L4.54,4.41 L2.82,3.55 A0.5,0.5 0,0,0 2.15,3.78 Z" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1" />
                    <path d="M13.5,8.5 L15.23,7.62 A0.5,0.5 0,0,0 15.45,6.95 L13.85,3.78 A0.5,0.5 0,0,0 13.18,3.55 L11.46,4.41 Z" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1" />
                    <path d="M11.5,4.5 L9,4.5 L6.15,7.27 A0.5,0.5 0,0,0 6.24,8.05 C7.33,8.74 8.81,8.72 10,7.5 L12.5,9.5 L13.5,8.5" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1" />
                    <polyline points="7.75 13.5 5.15 12.85 3.5 11.67" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1" />
                </svg>
            </div>
            パートナーインテグレーション
        </div>;
};

export const Image = ({img, alt, size = "lg"}) => {
  const normalizedSize = ["sm", "md", "lg"].includes(size) ? size : "lg";
  return <div className={`ch-image-${normalizedSize}`}>
      <Frame>
        <img src={img} alt={alt} />
      </Frame>
    </div>;
};

<PartnerBadge />

<a href="https://www.bladepipe.com/" target="_blank">BladePipe</a> は、サブ秒レベルの低レイテンシでプラットフォーム間のシームレスなデータフローを実現する、リアルタイムのエンドツーエンド Data Integration ツールです。

ClickHouse は、BladePipe であらかじめ用意されているコネクタの 1 つで、さまざまなソースのデータを ClickHouse に自動的に取り込めます。このページでは、データを ClickHouse にリアルタイムで読み込む方法を順を追って説明します。

<div id="supported-sources">
  ## 対応しているソース
</div>

現在、BladePipe は以下のソースから ClickHouse へのData Integrationに対応しています。

* MySQL/MariaDB/AuroraMySQL
* Oracle
* PostgreSQL/AuroraPostgreSQL
* MongoDB
* Kafka
* PolarDB-MySQL
* OceanBase
* TiDB

今後さらに多くのソースに対応する予定です。

<Steps>
  <Step title="BladePipe をダウンロードして実行する" id="1-run-bladepipe">
    1. <a href="https://www.bladepipe.com/" target="_blank">BladePipe Cloud</a> にログインします。

    2. <a href="https://doc.bladepipe.com/productOP/byoc/installation/install_worker_docker" target="_blank">Worker のインストール (Docker) </a> または <a href="https://doc.bladepipe.com/productOP/byoc/installation/install_worker_binary" target="_blank">Worker のインストール (バイナリ) </a> の手順に従って、BladePipe Worker をダウンロードしてインストールします。

    <Note>
      または、<a href="https://doc.bladepipe.com/productOP/onPremise/installation/install_all_in_one_binary" target="_blank">BladePipe Enterprise</a> をダウンロードしてデプロイすることもできます。
    </Note>
  </Step>

  <Step title="ターゲットとして ClickHouse を追加する" id="2-add-clickhouse-as-a-target">
    <Note>
      1. BladePipe は ClickHouse バージョン `20.12.3.3` 以降をサポートしています。
      2. ClickHouse をターゲットとして使用するには、ユーザーに SELECT、INSERT、および一般的な DDL 権限が付与されていることを確認してください。
    </Note>

    1. BladePipe で、"DataSource" > "Add DataSource" をクリックします。

    2. `ClickHouse` を選択し、ClickHouse のホストとポート、ユーザー名とパスワードを入力して設定を行い、"Test Connection" をクリックします。

           <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/bp_ck_1.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=63b11e4a76a8fedaf8a98c4d3a496fa6" size="lg" border alt="ターゲットとして ClickHouse を追加" width="1882" height="1744" data-path="images/integrations/data-ingestion/etl-tools/bp_ck_1.webp" />

    3. 下部にある "Add DataSource" をクリックすると、ClickHouse インスタンスが追加されます。
  </Step>

  <Step title="MySQL をソースとして追加する" id="3-add-mysql-as-a-source">
    このチュートリアルでは、ソースとして MySQL インスタンスを使用し、MySQL のデータを ClickHouse に読み込む手順を説明します。

    <Note>
      MySQL をソースとして使用するには、ユーザーに<a href="https://doc.bladepipe.com/dataMigrationAndSync/datasource_func/MySQL/privs_for_mysql" target="_blank">必要な権限</a>があることを確認してください。
    </Note>

    1. BladePipe で、"DataSource" > "Add DataSource" をクリックします。

    2. `MySQL` を選択し、MySQL のホストとポート、ユーザー名、パスワードを入力して設定を行い、"Test Connection" をクリックします。

           <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/bp_ck_2.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=86149981e4823e8ffc94d870405a0674" size="lg" border alt="MySQL をソースとして追加" width="1882" height="1746" data-path="images/integrations/data-ingestion/etl-tools/bp_ck_2.webp" />

    3. 下部の "Add DataSource" をクリックすると、MySQL インスタンスが追加されます。
  </Step>

  <Step title="パイプラインを作成する" id="4-create-a-pipeline">
    1. BladePipe で、"DataJob" > "Create DataJob" をクリックします。

    2. 追加した MySQL インスタンスと ClickHouse インスタンスを選択し、"Test Connection" をクリックして BladePipe がそれぞれのインスタンスに接続できることを確認します。続いて、移行対象のデータベースを選択します。
           <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/bp_ck_3.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=6c86c863a807dc03306618540b9167ab" size="lg" border alt="ソースとターゲットを選択" width="3264" height="1904" data-path="images/integrations/data-ingestion/etl-tools/bp_ck_3.webp" />

    3. DataJob Type で "Incremental" を選択し、あわせて "Full Data" オプションも選択します。
           <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/bp_ck_4.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=0bb27a97a3e1b70fd1b5590af98ea1e8" size="lg" border alt="同期タイプを選択" width="2248" height="1884" data-path="images/integrations/data-ingestion/etl-tools/bp_ck_4.webp" />

    4. 複製するテーブルを選択します。
           <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/bp_ck_5.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=750373dc99b3fc14365d4b8b5cba5786" size="lg" border alt="テーブルを選択" width="2956" height="1730" data-path="images/integrations/data-ingestion/etl-tools/bp_ck_5.webp" />

    5. 複製するカラムを選択します。
           <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/bp_ck_6.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=d4fb0124a2705ab7b41cc727645b326b" size="lg" border alt="カラムを選択" width="2960" height="1738" data-path="images/integrations/data-ingestion/etl-tools/bp_ck_6.webp" />

    6. DataJob の作成を確認すると、DataJob は自動的に実行されます。
           <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/bp_ck_8.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=abbfdab480cf84fbe2047ec33a0b9111" size="lg" border alt="DataJob は実行中です" width="2244" height="294" data-path="images/integrations/data-ingestion/etl-tools/bp_ck_8.webp" />
  </Step>

  <Step title="データを検証する" id="5-verify-the-data">
    1. MySQL インスタンスへのデータ書き込みを停止し、ClickHouse でデータがマージされるまで待ちます。

    <Note>
      ClickHouse の自動マージのタイミングは予測できないため、`OPTIMIZE TABLE xxx FINAL;` コマンドを実行して手動でマージをトリガーできます。ただし、この手動マージは必ず成功するとは限りません。

      または、`CREATE VIEW xxx_v AS SELECT * FROM xxx FINAL;` コマンドを実行してビューを作成し、そのビューに対してクエリを実行することで、データが完全にマージされていることを確認できます。
    </Note>

    2. <a href="https://doc.bladepipe.com/operation/job_manage/create_job/create_period_verification_correction_job" target="_blank">検証用 DataJob</a> を作成します。検証用 DataJob が完了したら、結果を確認し、ClickHouse のデータが MySQL のデータと一致していることを確認します。
           <Image img="https://mintcdn.com/private-7c7dfe99/pIetLsS_hOGHqoPJ/images/integrations/data-ingestion/etl-tools/bp_ck_9.webp?fit=max&auto=format&n=pIetLsS_hOGHqoPJ&q=85&s=85a6aedaebcf7d61338b632241660fda" size="lg" border alt="データを検証" width="2234" height="286" data-path="images/integrations/data-ingestion/etl-tools/bp_ck_9.webp" />
  </Step>
</Steps>
