> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-fbfa8bee.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 控制 MongoDB ClickPipe 同步

> 关于控制 MongoDB ClickPipe 同步的文档

export const Image = ({img, alt, size}) => {
  return <Frame>
      <img src={img} alt={alt} />
    </Frame>;
};

本文档介绍如何在 ClickPipe 处于 **CDC (运行中) 模式** 时控制 MongoDB ClickPipe 的同步过程。

<div id="overview">
  ## 概览
</div>

数据库 ClickPipes 的架构由两个并行过程组成：从源数据库拉取，以及向目标数据库推送。拉取过程由同步配置控制，该配置定义了数据拉取的频率，以及每次拉取的数据量。这里的“每次”是指一个批次——因为 ClickPipe 会按批次拉取和推送数据。

控制 MongoDB ClickPipe 同步主要有两种方式。当以下任一设置触发时，ClickPipe 就会开始推送。

<div id="interval">
  ### 同步间隔
</div>

管道的同步间隔是指 ClickPipe 从源数据库拉取记录的持续时间 (以秒为单位) 。将已拉取的数据推送到 ClickHouse 所花费的时间不计入此间隔。

默认值为 **1 分钟**。
同步间隔可以设置为任意正整数，但建议保持在 10 秒以上。

<div id="batch-size">
  ### 拉取批次大小
</div>

拉取批次大小是指 ClickPipe 单次从源数据库拉取的记录数。这里的记录包括属于该管道的 collection 上发生的插入、更新和删除操作。

默认值为 **100,000** 条记录。
建议的安全最大值为 1000 万。

<div id="configuring">
  ### 配置同步设置
</div>

创建 ClickPipe 或编辑现有 ClickPipe 时，您可以设置同步间隔和拉取批次大小。
创建 ClickPipe 时，这些设置会显示在创建向导的第二步，如下所示：

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/kkh98eOd_iRyUp1R/images/integrations/data-ingestion/clickpipes/postgres/create_sync_settings.png?fit=max&auto=format&n=kkh98eOd_iRyUp1R&q=85&s=dbcccdd0f80f4f70e2ad1aea1c9f0124" alt="创建同步设置" size="md" width="902" height="654" data-path="images/integrations/data-ingestion/clickpipes/postgres/create_sync_settings.png" />

编辑现有 ClickPipe 时，您可以前往该管道的 **Settings** 选项卡，先暂停管道，然后点击此处的 **Configure**：

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/kkh98eOd_iRyUp1R/images/integrations/data-ingestion/clickpipes/postgres/edit_sync_button.png?fit=max&auto=format&n=kkh98eOd_iRyUp1R&q=85&s=ef8e8adfc27a5c01c7af37fb67a4c3e8" alt="编辑同步按钮" size="md" width="933" height="417" data-path="images/integrations/data-ingestion/clickpipes/postgres/edit_sync_button.png" />

此时会打开一个包含同步设置的弹出面板，您可以在其中更改同步间隔和拉取批次大小：

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/kkh98eOd_iRyUp1R/images/integrations/data-ingestion/clickpipes/postgres/sync_settings_edit.png?fit=max&auto=format&n=kkh98eOd_iRyUp1R&q=85&s=fee0afbd90b0b8d88cc66b7ea2342a36" alt="编辑同步设置" size="md" width="598" height="588" data-path="images/integrations/data-ingestion/clickpipes/postgres/sync_settings_edit.png" />

<div id="monitoring">
  ### 监控同步控制行为
</div>

你可以在 ClickPipe 的 **指标** 选项卡中的 **CDC Syncs** 表中查看每个批次的耗时。请注意，这里的耗时既包括推送时间，也包括在没有行传入时 ClickPipe 的等待时间。

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/kkh98eOd_iRyUp1R/images/integrations/data-ingestion/clickpipes/postgres/cdc_syncs.png?fit=max&auto=format&n=kkh98eOd_iRyUp1R&q=85&s=d5e8baded42e7b1448e913b86a2374ec" alt="CDC Syncs 表" size="md" width="2428" height="626" data-path="images/integrations/data-ingestion/clickpipes/postgres/cdc_syncs.png" />
