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

> Crunchy Bridge Postgres를 ClickPipes 소스로 설정합니다

# Crunchy Bridge Postgres 소스 설정 가이드

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

ClickPipes는 Postgres 12 이상 버전을 지원합니다.

<div id="enable-logical-replication">
  ## 논리적 복제 활성화
</div>

Crunchy Bridge는 [기본적으로](https://docs.crunchybridge.com/how-to/logical-replication) 논리적 복제가 활성화되어 있습니다. 아래 설정이 올바르게 구성되어 있는지 확인하고, 아니라면 그에 맞게 조정하십시오.

```sql theme={null}
SHOW wal_level; -- logical이어야 합니다
SHOW max_wal_senders; -- 10이어야 합니다
SHOW max_replication_slots; -- 10이어야 합니다
```

<div id="creating-clickpipes-user-and-granting-permissions">
  ## ClickPipes 사용자 생성 및 권한 부여
</div>

`postgres` 사용자로 Crunchy Bridge Postgres에 연결한 후, 아래 명령을 실행합니다.

1. ClickPipes 전용 사용자를 생성합니다.

   ```sql theme={null}
   CREATE USER clickpipes_user PASSWORD 'some-password';
   ```

2. 이전 단계에서 생성한 사용자에게 스키마 수준의 읽기 전용 권한을 부여합니다. 다음 예시는 `public` 스키마에 대한 권한을 보여줍니다. 복제하려는 테이블이 포함된 각 스키마에 대해 이 명령을 반복하십시오.

   ```sql theme={null}
   GRANT USAGE ON SCHEMA "public" TO clickpipes_user;
   GRANT SELECT ON ALL TABLES IN SCHEMA "public" TO clickpipes_user;
   ALTER DEFAULT PRIVILEGES IN SCHEMA "public" GRANT SELECT ON TABLES TO clickpipes_user;
   ```

3. 사용자에게 복제 권한을 부여합니다.

   ```sql theme={null}
    ALTER USER clickpipes_user WITH REPLICATION;
   ```

4. 복제하려는 테이블을 포함하는 [publication](https://www.postgresql.org/docs/current/logical-replication-publication.html)을 생성합니다. 성능 오버헤드를 피하기 위해 publication에는 필요한 테이블만 포함할 것을 강력히 권장합니다.

<Warning>
  publication에 포함되는 모든 테이블에는 **기본 키(primary key)** 가 정의되어 있거나, *또는* **레플리카 아이덴티티(replica identity)** 가 `FULL`로 설정되어 있어야 합니다. 범위를 지정하는 방법에 대한 자세한 내용은 [Postgres FAQs](/ko/integrations/clickpipes/postgres/faq#how-should-i-scope-my-publications-when-setting-up-replication)를 참조하십시오.
</Warning>

* 특정 테이블에 대한 publication을 생성하려면 다음과 같이 합니다.

  ```sql theme={null}
  CREATE PUBLICATION clickpipes FOR TABLE table_to_replicate, table_to_replicate2;
  ```

  * 특정 스키마의 모든 테이블에 대한 publication을 생성하려면 다음과 같이 합니다.

    ```sql theme={null}
    CREATE PUBLICATION clickpipes FOR TABLES IN SCHEMA "public";
    ```

`clickpipes` publication에는 지정된 테이블에서 생성된 변경 이벤트 집합이 포함되며, 이후 복제 스트림을 수집하는 데 사용됩니다.

<div id="safe-list-clickpipes-ips">
  ## ClickPipes IP를 허용 목록에 등록하기
</div>

Crunchy Bridge에서 Firewall Rules를 추가해 [ClickPipes IPs](/ko/integrations/clickpipes/home#list-of-static-ips)를 허용 목록에 등록합니다.

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-86180b7b/Y68OqC2yh4RTThBq/images/integrations/data-ingestion/clickpipes/postgres/source/setup/crunchy-postgres/firewall_rules_crunchy_bridge.png?fit=max&auto=format&n=Y68OqC2yh4RTThBq&q=85&s=c11486ed981fa141f47e4eb9170ac461" alt="Crunchy Bridge에서 Firewall Rules를 찾는 위치" border width="3024" height="1516" data-path="images/integrations/data-ingestion/clickpipes/postgres/source/setup/crunchy-postgres/firewall_rules_crunchy_bridge.png" />

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-86180b7b/Y68OqC2yh4RTThBq/images/integrations/data-ingestion/clickpipes/postgres/source/setup/crunchy-postgres/add_firewall_rules_crunchy_bridge.png?fit=max&auto=format&n=Y68OqC2yh4RTThBq&q=85&s=77b37c12b293bd6e24cef25883fd3077" alt="ClickPipes용 Firewall Rules 추가" border width="3024" height="1030" data-path="images/integrations/data-ingestion/clickpipes/postgres/source/setup/crunchy-postgres/add_firewall_rules_crunchy_bridge.png" />

<div id="whats-next">
  ## 다음 단계는 무엇인가요?
</div>

이제 [ClickPipe를 생성](/ko/integrations/clickpipes/postgres)하고 Postgres 인스턴스에서 ClickHouse Cloud로 데이터를 수집하기 시작할 수 있습니다.
ClickPipe 생성 과정에서 필요하므로, Postgres 인스턴스를 설정할 때 사용한 연결 정보를 반드시 기록해 두십시오.
