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

# ClickPipes로 ClickHouse에 동기화하기

> 내장 CDC 기능을 사용하여 Postgres 데이터를 ClickHouse로 복제합니다

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

export const BetaBadge = ({link, galaxyTrack, galaxyEvent}) => {
  if (link) {
    return <a href={link} target="_blank" rel="noopener noreferrer" className="betaBadge" onClick={galaxyTrack && galaxyEvent ? galaxyOnClick(galaxyEvent) : undefined}>
                <span>베타</span>
            </a>;
  }
  return <a href="https://clickhouse.com/docs/reference/settings/beta-and-experimental-features#beta-features" className="betaBadge">
            <span>베타 기능</span>
        </a>;
};

<BetaBadge link="https://clickhouse.com/cloud/postgres" galaxyTrack={true} galaxyEvent="docs.managed-postgres.clickhouse-integration-beta" />

모든 ClickHouse Managed Postgres 인스턴스에는 어떤 ClickHouse 서비스로든 데이터를 복제할 수 있는 CDC 기능이 기본 제공됩니다. 이를 통해 Postgres 인스턴스의 데이터 일부 또는 전체를 ClickHouse로 옮기고, Postgres에서 발생한 데이터 변경 사항을 거의 실시간으로 ClickHouse에 지속적으로 반영할 수 있습니다. 이 기능은 내부적으로 [ClickPipes](/ko/integrations/clickpipes/home)로 구동됩니다.

이 기능을 사용하려면 Postgres 인스턴스의 사이드바에서 **Sync to ClickHouse**를 클릭하십시오.

<Image img="https://mintcdn.com/private-7c7dfe99-vortex-format/xHfTFhAoB3hIpGFb/images/managed-postgres/clickhouse-integration-intro.webp?fit=max&auto=format&n=xHfTFhAoB3hIpGFb&q=85&s=f2de966f7661a462fbb9a0a310bbb270" alt="사이드바에 통합 옵션을 표시하는 ClickHouse 통합 랜딩 페이지" size="md" border width="1526" height="956" data-path="images/managed-postgres/clickhouse-integration-intro.webp" />

<Note>
  진행하기 전에 ClickPipes 서비스에서 Postgres 서비스에 액세스할 수 있는지 확인하십시오. 기본적으로는 액세스가 가능하지만, IP 액세스를 제한한 경우 **ClickHouse 서비스**가 위치한 리전에 따라 [이](/ko/integrations/clickpipes/networking/static-ips) 목록의 일부 소스 IP에 대해 액세스를 허용해야 할 수 있습니다.
</Note>

**Replicate data in ClickHouse**를 클릭하여 ClickPipe 설정을 시작하십시오.

<Steps>
  <Step title="복제 서비스 구성" id="configure-replication-service">
    복제 설정을 입력하십시오:

    * **Integration name**: 이 ClickPipe의 이름
    * **ClickHouse service**: 기존 ClickHouse Cloud 서비스를 선택하거나 새로 생성
    * **Postgres database**: 복제할 원본 데이터베이스
    * **Replication method**: 다음 중 하나를 선택
      * **Initial load + CDC**: 기존 데이터를 가져오고 이후 변경 사항을 반영해 테이블을 계속 최신 상태로 유지(권장)
      * **Initial load only**: 기존 데이터를 일회성으로 스냅샷하며 이후 업데이트는 없음
      * **CDC only**: 초기 스냅샷을 건너뛰고 이후 발생하는 변경 사항만 캡처

    <Image img="https://mintcdn.com/private-7c7dfe99-vortex-format/xHfTFhAoB3hIpGFb/images/managed-postgres/replication-service-step.webp?fit=max&auto=format&n=xHfTFhAoB3hIpGFb&q=85&s=71c792ea56ab5ed02222c2979498ae84" alt="통합 이름, 대상 서비스, 복제 방식 옵션을 보여주는 복제 서비스 구성 화면" size="md" border width="1620" height="956" data-path="images/managed-postgres/replication-service-step.webp" />

    **다음**을 클릭하여 계속 진행하십시오.
  </Step>

  <Step title="복제 설정 구성" id="replication-settings">
    데이터가 복제되는 방식을 세밀하게 조정하십시오:

    * **Sync interval (seconds)**: Postgres에서 변경 사항을 가져오는 주기(기본값: 60)
    * **Parallel threads for initial load**: 초기 스냅샷 시 사용되는 스레드 수(기본값: 4)
    * **pull batch 크기**: 복제 중 배치당 가져오는 행 수(기본값: 100000)
    * **Snapshot number of rows per partition**: 초기 스냅샷 시 파티션당 행 수(기본값: 100000)
    * **Snapshot number of tables in parallel**: 동시에 스냅샷할 테이블 수(기본값: 1)

    <Image img="https://mintcdn.com/private-7c7dfe99-vortex-format/xHfTFhAoB3hIpGFb/images/managed-postgres/integration-replication-settings.webp?fit=max&auto=format&n=xHfTFhAoB3hIpGFb&q=85&s=f73c47e084727b55d05755db6127c896" alt="동기화 인터벌, 병렬 스레드, pull batch 크기, 스냅샷 구성 옵션을 보여주는 복제 설정 단계" size="md" border width="1526" height="957" data-path="images/managed-postgres/integration-replication-settings.webp" />

    **다음**을 클릭하여 계속 진행하십시오.
  </Step>

  <Step title="복제할 테이블 선택" id="select-tables">
    대상 데이터베이스를 선택하고 복제할 테이블을 지정하십시오:

    * **Destination database**: 기존 ClickHouse 데이터베이스를 선택하거나 새로 생성
    * **Prefix default destination table names with schema name**: 이름 충돌을 방지하기 위해 Postgres 스키마를 접두사로 추가
    * **Preserve NULL values from source**: 타입 기본값으로 변환하지 않고 NULL 값을 그대로 유지합니다. 이 설정은 파이프의 모든 테이블에 적용되며, 파이프를 생성한 후에는 변경할 수 없습니다.
    * **Remove deleted rows during merges**: [ReplacingMergeTree](/ko/reference/engines/table-engines/mergetree-family/replacingmergetree) 테이블에서 백그라운드 머지 시 삭제된 행을 물리적으로 제거합니다

    스키마를 펼쳐 복제할 개별 테이블을 선택하십시오. 대상 테이블 이름과 컬럼 설정도 사용자 지정할 수 있습니다.

    <Image img="https://mintcdn.com/private-7c7dfe99-vortex-format/xHfTFhAoB3hIpGFb/images/managed-postgres/select-tables-step.webp?fit=max&auto=format&n=xHfTFhAoB3hIpGFb&q=85&s=be0345181d3022080ad8653542714421" alt="데이터베이스 선택, 복제 옵션, 스키마별로 그룹화된 테이블 선택기를 보여주는 테이블 선택 단계" size="md" border width="2454" height="1804" data-path="images/managed-postgres/select-tables-step.webp" />

    **Replicate data to ClickHouse**를 클릭하여 복제를 시작하십시오.
  </Step>

  <Step title="ClickPipe 모니터링" id="monitor-clickpipe">
    ClickPipe가 시작되면 동일한 메뉴에 목록으로 표시됩니다. 전체 데이터의 초기 스냅샷은 테이블 크기에 따라 다소 시간이 걸릴 수 있습니다.

    <Image img="https://mintcdn.com/private-7c7dfe99-vortex-format/xHfTFhAoB3hIpGFb/images/managed-postgres/integration-running.webp?fit=max&auto=format&n=xHfTFhAoB3hIpGFb&q=85&s=37b194710421e11fdbeaf84474491c60" alt="실행 중인 ClickPipe와 해당 대상 서비스 및 상태를 보여주는 ClickHouse 통합 목록" size="md" border width="2518" height="622" data-path="images/managed-postgres/integration-running.webp" />

    통합 이름을 클릭하면 상세 상태를 확인하고, 진행 상황을 모니터링하며, 오류를 확인하고, ClickPipe를 관리할 수 있습니다. ClickPipe가 가질 수 있는 다양한 상태를 이해하려면 [Postgres ClickPipe의 수명 주기](/ko/integrations/clickpipes/postgres/lifecycle)를 참조하십시오.
  </Step>
</Steps>
