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

> Neon Postgres 인스턴스를 ClickPipes 소스로 설정합니다

# Neon Postgres 소스 설정 가이드

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

ClickPipes에서 복제에 사용할 Neon Postgres를 설정하는 방법을 안내하는 가이드입니다.
이 설정을 진행하기 전에 [Neon console](https://console.neon.tech/app/projects)에 로그인되어 있는지 확인하세요.

<div id="creating-a-user-with-permissions">
  ## 권한이 있는 사용자 생성
</div>

관리자 사용자로 Neon 인스턴스에 연결한 다음, 아래 명령을 실행합니다:

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

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

2. 앞 단계에서 생성한 사용자에게 스키마(schema) 수준의 읽기 전용 권한을 부여합니다. 아래 예시는 `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 FAQ](/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="enable-logical-replication">
  ## 논리적 복제 활성화
</div>

Neon에서는 UI를 통해 논리적 복제를 활성화할 수 있습니다. ClickPipes의 CDC가 데이터를 복제하려면 이 설정이 필요합니다.
**설정** 탭으로 이동한 다음 **논리적 복제** 섹션으로 이동하십시오.

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-8a08bda2/KeiVE4MGTrCd9SX4/images/integrations/data-ingestion/clickpipes/postgres/source/setup/neon-postgres/neon-enable-replication.png?fit=max&auto=format&n=KeiVE4MGTrCd9SX4&q=85&s=48071fa43f0fa6bd30e32e28d1d939c3" alt="논리적 복제 활성화" border width="3414" height="1336" data-path="images/integrations/data-ingestion/clickpipes/postgres/source/setup/neon-postgres/neon-enable-replication.png" />

여기에서 **활성화**를 클릭하면 설정이 완료됩니다. 활성화한 후에는 아래와 같은 성공 메시지가 표시됩니다.

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-8a08bda2/KeiVE4MGTrCd9SX4/images/integrations/data-ingestion/clickpipes/postgres/source/setup/neon-postgres/neon-enabled-replication.png?fit=max&auto=format&n=KeiVE4MGTrCd9SX4&q=85&s=5b36a18e401d76898f9f5ff1bc329bf0" alt="논리적 복제 활성화됨" border width="3414" height="1336" data-path="images/integrations/data-ingestion/clickpipes/postgres/source/setup/neon-postgres/neon-enabled-replication.png" />

Neon Postgres 인스턴스에서 아래 설정을 확인하겠습니다:

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

<div id="ip-whitelisting-for-neon-enterprise-plan">
  ## IP 화이트리스트 등록(Neon Enterprise 플랜용)
</div>

Neon Enterprise 플랜을 사용하는 경우 [ClickPipes IPs](/ko/integrations/clickpipes/home#list-of-static-ips)를 허용 목록에 추가하면 ClickPipes에서 Neon Postgres 인스턴스로의 복제를 허용할 수 있습니다.
이 작업을 수행하려면 **설정** 탭을 클릭한 다음 **IP 허용** 섹션으로 이동하세요.

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-8a08bda2/KeiVE4MGTrCd9SX4/images/integrations/data-ingestion/clickpipes/postgres/source/setup/neon-postgres/neon-ip-allow.png?fit=max&auto=format&n=KeiVE4MGTrCd9SX4&q=85&s=3258da672938ed40465484eeeedc2ca5" alt="IP 허용 화면" border width="2184" height="1184" data-path="images/integrations/data-ingestion/clickpipes/postgres/source/setup/neon-postgres/neon-ip-allow.png" />

<div id="copy-connection-details">
  ## 연결 정보 복사
</div>

이제 사용자와 publication이 준비되고 복제가 활성화되었으므로 새 ClickPipe를 만들기 위한 연결 정보를 복사할 수 있습니다.
**Dashboard**로 이동한 다음, 연결 문자열이 표시된 텍스트 상자에서
보기를 **Parameters Only**로 변경하세요. 다음 단계에서 이 매개변수가 필요합니다.

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-8a08bda2/KeiVE4MGTrCd9SX4/images/integrations/data-ingestion/clickpipes/postgres/source/setup/neon-postgres/neon-conn-details.png?fit=max&auto=format&n=KeiVE4MGTrCd9SX4&q=85&s=97d802b86211788c13f2f715bec1f04e" alt="연결 정보" border width="1932" height="1438" data-path="images/integrations/data-ingestion/clickpipes/postgres/source/setup/neon-postgres/neon-conn-details.png" />

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

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