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

> ClickPipes 소스로 Google Cloud SQL Postgres 인스턴스를 설정합니다

# Google Cloud SQL Postgres 소스 설정 가이드

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

<Info>
  지원되는 제공업체 중 하나를 사용하는 경우(사이드바 참조), 해당 제공업체의 가이드를 참조하십시오.
</Info>

<div id="supported-postgres-versions">
  ## 지원되는 Postgres 버전
</div>

Postgres 12 이상 버전

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

`cloudsql. logical_decoding` 설정이 켜져 있다면 **아래 단계를 따를 필요는 없습니다**. 다른 데이터 복제 도구에서 마이그레이션하는 경우에는 이 설정이 대체로 미리 구성되어 있습니다.

1. Overview 페이지에서 **Edit** 버튼을 클릭하세요.

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/a9Bs4XObb7pMATI7/images/integrations/data-ingestion/clickpipes/postgres/source/google-cloudsql/edit.png?fit=max&auto=format&n=a9Bs4XObb7pMATI7&q=85&s=155e2904690884822e02118c53e54828" alt="Cloud SQL Postgres의 Edit 버튼" size="lg" border width="3024" height="1964" data-path="images/integrations/data-ingestion/clickpipes/postgres/source/google-cloudsql/edit.png" />

2. Flags로 이동하여 `cloudsql.logical_decoding`을 `on`으로 변경하세요. 이 변경 사항을 적용하려면 Postgres 서버를 다시 시작해야 합니다.

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/a9Bs4XObb7pMATI7/images/integrations/data-ingestion/clickpipes/postgres/source/google-cloudsql/cloudsql_logical_decoding1.png?fit=max&auto=format&n=a9Bs4XObb7pMATI7&q=85&s=ceac343ba913bb44586099929758879c" alt="`cloudsql.logical_decoding`을 `on`으로 변경" size="lg" border width="3024" height="1964" data-path="images/integrations/data-ingestion/clickpipes/postgres/source/google-cloudsql/cloudsql_logical_decoding1.png" />

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/a9Bs4XObb7pMATI7/images/integrations/data-ingestion/clickpipes/postgres/source/google-cloudsql/cloudsql_logical_decoding3.png?fit=max&auto=format&n=a9Bs4XObb7pMATI7&q=85&s=7ca4e440af1320b514c1223f0dba6205" alt="서버 다시 시작" size="lg" border width="3024" height="1964" data-path="images/integrations/data-ingestion/clickpipes/postgres/source/google-cloudsql/cloudsql_logical_decoding3.png" />

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

관리자 사용자로 Cloud SQL 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 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에는 지정된 테이블에서 생성된 변경 이벤트 집합이 포함되며, 이후 복제 스트림을 수집하는 데 사용됩니다.

[//]: # "TODO Add SSH Tunneling"

<div id="add-clickpipes-ips-to-firewall">
  ## ClickPipes IP를 방화벽에 추가하기
</div>

아래 단계에 따라 네트워크에 ClickPipes IP를 추가하십시오.

<Note>
  SSH 터널링을 사용하는 경우 [ClickPipes IP](/ko/integrations/clickpipes/home#list-of-static-ips)를 점프 서버/배스천의 방화벽 규칙에 추가해야 합니다.
</Note>

1. **연결** 섹션으로 이동합니다

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/a9Bs4XObb7pMATI7/images/integrations/data-ingestion/clickpipes/postgres/source/google-cloudsql/connections.png?fit=max&auto=format&n=a9Bs4XObb7pMATI7&q=85&s=ee3f0a333b0ed7dd1d8ca4fd0877b073" alt="Cloud SQL의 연결 섹션" size="lg" border width="3024" height="1964" data-path="images/integrations/data-ingestion/clickpipes/postgres/source/google-cloudsql/connections.png" />

2. **네트워킹** 하위 섹션으로 이동합니다

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/a9Bs4XObb7pMATI7/images/integrations/data-ingestion/clickpipes/postgres/source/google-cloudsql/connections_networking.png?fit=max&auto=format&n=a9Bs4XObb7pMATI7&q=85&s=b73f13d6e2dca805bc2893c4da19d46b" alt="Cloud SQL의 네트워킹 하위 섹션" size="lg" border width="3024" height="1964" data-path="images/integrations/data-ingestion/clickpipes/postgres/source/google-cloudsql/connections_networking.png" />

3. [ClickPipes의 공용 IP](/ko/integrations/clickpipes/home#list-of-static-ips)를 추가합니다

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/a9Bs4XObb7pMATI7/images/integrations/data-ingestion/clickpipes/postgres/source/google-cloudsql/firewall1.png?fit=max&auto=format&n=a9Bs4XObb7pMATI7&q=85&s=9ea93839597efd4a5c9fe5d82c20533a" alt="방화벽에 ClickPipes 네트워크 추가" size="lg" border width="3024" height="1964" data-path="images/integrations/data-ingestion/clickpipes/postgres/source/google-cloudsql/firewall1.png" />

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/a9Bs4XObb7pMATI7/images/integrations/data-ingestion/clickpipes/postgres/source/google-cloudsql/firewall2.png?fit=max&auto=format&n=a9Bs4XObb7pMATI7&q=85&s=d1c3a79720a4a8cbf76cf56349e5fae9" alt="방화벽에 ClickPipes 네트워크가 추가됨" size="lg" border width="3024" height="1964" data-path="images/integrations/data-ingestion/clickpipes/postgres/source/google-cloudsql/firewall2.png" />

<div id="whats-next">
  ## 다음 단계
</div>

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