> ## Documentation Index
> Fetch the complete documentation index at: https://www.integrate.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Self-hosted PostgreSQL source for ELT & CDC

> Configure a self-hosted PostgreSQL instance as a CDC source in Integrate.io ELT & CDC. Set wal_level to logical and allow the sync user to connect.

This page covers the **self-hosted-specific** steps to prepare your PostgreSQL instance for ELT & CDC. After completing them, follow the common setup (sync user grants, heartbeat table, publication, and replication slot) on the [PostgreSQL source for ELT & CDC](/cdc/postgresql) page.

## Requirements

* PostgreSQL **version 10 or above**.
* Connect to the **primary** instance. Logical replication only works on the primary.
* Tables with a `PRIMARY KEY`.
* Network access from Integrate.io to your database (direct, [SSH tunnel](/cdc/ssh-tunnel), or [reverse SSH tunnel](/cdc/reverse-ssh-tunnel)).

## Enable logical replication

Set `wal_level` to `logical`:

```sql theme={null}
ALTER SYSTEM SET wal_level TO 'logical';
```

Restart the database for the change to take effect.

## Allow the sync user to replicate

In `pg_hba.conf`, ensure the sync user has both regular and replication connection entries from the Integrate.io source IPs, for example:

```text theme={null}
host    <database>    integrateio    <integrateio_ip>/32    md5
host    replication   integrateio    <integrateio_ip>/32    md5
```

Reload PostgreSQL after editing `pg_hba.conf`.

After creating the sync user (see the [common setup](/cdc/postgresql#setup-steps-customer-managed)), grant the replication attribute:

```sql theme={null}
ALTER ROLE integrateio WITH REPLICATION;
```

## Next: common setup

Continue with the canonical PostgreSQL setup for the remaining steps — sync user privileges (`USAGE`, `SELECT`, `REFERENCES`), heartbeat table, publication, and replication slot:

<Card title="PostgreSQL source for ELT & CDC" icon="arrow-right" href="/cdc/postgresql" horizontal />

<CardGroup cols={2}>
  <Card title="SSH Tunnel" icon="arrow-right" href="/cdc/ssh-tunnel" horizontal />

  <Card title="Reverse SSH Tunnel" icon="arrow-right" href="/cdc/reverse-ssh-tunnel" horizontal />
</CardGroup>
