> ## 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.

> 创建你的首个 Kafka ClickPipe 的分步指南。

# 创建你的首个 Kafka ClickPipe

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>;
};

> 本指南将介绍如何创建你的首个 Kafka ClickPipe。

Kafka ClickPipes 既可以通过 ClickPipes UI 手动部署和管理，也可以通过 [OpenAPI](/docs/zh/integrations/clickpipes/programmatic-access/openapi) 和 [Terraform](/docs/zh/integrations/clickpipes/programmatic-access/terraform) 以编程方式进行部署和管理。

<Steps>
  <Step title="前往数据源" id="1-load-sql-console">
    在左侧菜单中选择 `Data Sources` 按钮，然后点击 "Set up a ClickPipe"。

    <Image img="https://mintcdn.com/private-7c7dfe99/Rm4A9_kDxZf0ApeE/images/integrations/data-ingestion/clickpipes/cp_step0.webp?fit=max&auto=format&n=Rm4A9_kDxZf0ApeE&q=85&s=fb04bb07245be43cb784fa68cee62287" alt="选择导入项" size="md" width="2606" height="790" data-path="images/integrations/data-ingestion/clickpipes/cp_step0.webp" />
  </Step>

  <Step title="选择数据源" id="2-select-data-source">
    从列表中选择你的 Kafka 数据源。

    <Image img="https://mintcdn.com/private-7c7dfe99/Rm4A9_kDxZf0ApeE/images/integrations/data-ingestion/clickpipes/cp_step1.webp?fit=max&auto=format&n=Rm4A9_kDxZf0ApeE&q=85&s=43a323a7dbf7daf017f2b8498336363d" alt="选择数据源类型" size="md" width="2600" height="1890" data-path="images/integrations/data-ingestion/clickpipes/cp_step1.webp" />
  </Step>

  <Step title="配置数据源" id="3-configure-data-source">
    填写表单，为 ClickPipe 填写名称、描述 (可选) 、凭证以及其他连接信息。

    <Image img="https://mintcdn.com/private-7c7dfe99/Rm4A9_kDxZf0ApeE/images/integrations/data-ingestion/clickpipes/cp_step2.webp?fit=max&auto=format&n=Rm4A9_kDxZf0ApeE&q=85&s=cf8eb2563de1c256e798ce9ffbef6056" alt="填写连接信息" size="md" width="1896" height="1370" data-path="images/integrations/data-ingestion/clickpipes/cp_step2.webp" />
  </Step>

  <Step title="配置 Schema Registry (可选)" id="4-configure-your-schema-registry">
    对于 Avro 和 Protobuf topic，需要提供有效的 schema。有关如何配置 Schema Registry 的更多信息，请参阅 [Schema registries](/docs/zh/integrations/clickpipes/kafka/schema-registries)。
  </Step>

  <Step title="配置反向专用终结点 (可选)" id="5-configure-reverse-private-endpoint">
    配置反向专用终结点，使 ClickPipes 能够通过 AWS PrivateLink 连接到您的 Kafka 集群。
    如需了解更多信息，请参阅我们的 [AWS PrivateLink 文档](/docs/zh/integrations/clickpipes/aws-privatelink)。
  </Step>

  <Step title="配置 SSH 隧道 (可选)" id="6-configure-ssh-tunneling">
    如果你的 Kafka broker 无法通过公网访问，可以使用 SSH 隧道。ClickPipes 不会直接连接到 Kafka broker，而是先与堡垒机 (你网络中可通过公网访问的服务器) 建立 SSH 连接，再通过该堡垒机将流量转发到私有网络中的 Kafka broker。

    1. 打开“SSH Tunnel”开关。
    2. 填写 SSH 连接信息：
       * **SSH Host**：堡垒机的主机名或 IP 地址，即可通过公网访问、作为私有网络入口网关的服务器。
       * **SSH Port**：堡垒机上的 SSH 端口 (默认 `22`) 。
       * **SSH User**：用于在堡垒机上进行身份验证的用户名。

    <Image img="https://mintcdn.com/private-7c7dfe99/Rm4A9_kDxZf0ApeE/images/integrations/data-ingestion/clickpipes/cp_ssh_tunnel.webp?fit=max&auto=format&n=Rm4A9_kDxZf0ApeE&q=85&s=15add529b235ff43067e385a09d92c4c" alt="SSH 隧道配置" size="md" width="1810" height="1510" data-path="images/integrations/data-ingestion/clickpipes/cp_ssh_tunnel.webp" />

    3. 若要使用基于密钥的身份验证，请点击“Revoke and regenerate key pair”生成新的密钥对，并将生成的公钥复制到 SSH 服务器上的 `~/.ssh/authorized_keys` 中。
    4. 点击“Verify Connection”验证连接。

    <Note>
      请确保在 SSH 堡垒机的防火墙规则中将 [ClickPipes IP addresses](/docs/zh/integrations/clickpipes/home#list-of-static-ips) 加入白名单，以便 ClickPipes 能够建立 SSH 隧道。
    </Note>
  </Step>

  <Step title="选择你的 topic" id="7-select-your-topic">
    选择 topic 后，UI 将显示该 topic 中的一个示例文档。

    <Image img="https://mintcdn.com/private-7c7dfe99/Rm4A9_kDxZf0ApeE/images/integrations/data-ingestion/clickpipes/cp_step3.webp?fit=max&auto=format&n=Rm4A9_kDxZf0ApeE&q=85&s=ddd05f6d893131c4d625e5f9d5dd9923" alt="设置 topic" size="md" width="2380" height="1956" data-path="images/integrations/data-ingestion/clickpipes/cp_step3.webp" />
  </Step>

  <Step title="配置目标端表" id="8-configure-your-destination-table">
    在下一步中，您可以选择将数据摄取到新的 ClickHouse 表中，或使用现有表。按照界面上的说明修改表名、schema 和设置。您可以在顶部的样本表中实时预览这些更改。

    <Image img="https://mintcdn.com/private-7c7dfe99/Rm4A9_kDxZf0ApeE/images/integrations/data-ingestion/clickpipes/cp_step4a.webp?fit=max&auto=format&n=Rm4A9_kDxZf0ApeE&q=85&s=e0cdb9469f6867e897cc77541af7f59b" alt="设置表、schema 和设置" size="md" width="2734" height="1328" data-path="images/integrations/data-ingestion/clickpipes/cp_step4a.webp" />

    您还可以使用提供的控件自定义高级设置

    <Image img="https://mintcdn.com/private-7c7dfe99/Rm4A9_kDxZf0ApeE/images/integrations/data-ingestion/clickpipes/cp_table_settings.webp?fit=max&auto=format&n=Rm4A9_kDxZf0ApeE&q=85&s=71e36a5f059d6529ee2c81559a7a3a78" alt="设置高级设置控件" size="md" width="1592" height="338" data-path="images/integrations/data-ingestion/clickpipes/cp_table_settings.webp" />
  </Step>

  <Step title="配置权限" id="9-configure-permissions">
    ClickPipes 会创建一个专用用户，用于将数据写入目标表。你可以为该内部用户选择一个角色，可使用自定义角色或某个预定义角色：

    * `Full access`：对集群拥有完全访问权限。如果你在目标表上使用 materialized view 或字典，这可能会很有帮助。
    * `Only destination table`：仅拥有对目标表的 `INSERT` 权限。

    <Image img="https://mintcdn.com/private-7c7dfe99/Rm4A9_kDxZf0ApeE/images/integrations/data-ingestion/clickpipes/cp_step5.webp?fit=max&auto=format&n=Rm4A9_kDxZf0ApeE&q=85&s=71ea5baaa2c38fcc83b160f4856264ab" alt="权限" size="md" width="2736" height="1318" data-path="images/integrations/data-ingestion/clickpipes/cp_step5.webp" />
  </Step>

  <Step title="完成设置" id="10-complete-setup">
    点击 "Create ClickPipe" 后，系统将创建并运行您的 ClickPipe。随后，它会显示在“数据源”部分。

    <Image img="https://mintcdn.com/private-7c7dfe99/Rm4A9_kDxZf0ApeE/images/integrations/data-ingestion/clickpipes/cp_overview.webp?fit=max&auto=format&n=Rm4A9_kDxZf0ApeE&q=85&s=1ce91f5079842cfc66a4c88919f2e061" alt="查看概览" size="md" width="3436" height="1076" data-path="images/integrations/data-ingestion/clickpipes/cp_overview.webp" />
  </Step>
</Steps>
