Option 1: Sync to ClickHouse from the Postgres service
Open your ClickHouse Managed Postgres service in the ClickHouse Cloud console and click Sync to ClickHouse in the sidebar. The wizard pre-fills the source connection and lets you pick a destination ClickHouse service, the replication method, and the tables to replicate. No user, publication, or network setup is required. Follow the Sync to ClickHouse guide for a step-by-step walkthrough.Option 2: Select ClickHouse Managed Postgres as a source in ClickPipes
If you prefer to start from the destination side, open your ClickHouse service, go to Data Sources, and choose ClickHouse Managed Postgres from the list of sources. You then provide the connection details of your Postgres instance as you would for any other Postgres source.Connection details
Open your ClickHouse Managed Postgres service and click Connect to see the host, port, database, user, and password. Use the direct Postgres connection, not the via PgBouncer toggle: ClickPipes doesn’t support replication through PgBouncer or any other connection pooler. See Connection for details.Creating a user with permissions
You can connect with the defaultpostgres user. For production we recommend a dedicated, read-only replication user, exactly as for any other Postgres source. Connect to your instance with psql and run:
-
Create a dedicated user for ClickPipes:
-
Grant schema-level, read-only access to the user. The following example shows permissions for the
publicschema. Repeat these commands for each schema containing tables you want to replicate: -
Grant replication privileges to the user:
- Create a publication with the tables you want to replicate. We strongly recommend only including the tables you need in the publication to avoid performance overhead.
-
To create a publication for specific tables:
-
To create a publication for all tables in a specific schema:
Logical replication
Logical replication is already enabled on every ClickHouse Managed Postgres instance. There is nowal_level setting or parameter group to change. You can confirm with:
Network access
ClickHouse Managed Postgres accepts connections from ClickPipes by default. If you have configured IP filters on your Postgres service, add the ClickPipes static IP addresses for the region of your ClickHouse service to the allowed list.TLS
ClickHouse Managed Postgres instances present a certificate signed by a CA that is unique to the instance and not publicly trusted. ClickPipes enables certificate verification by default, so the connection check fails until you do one of the following:- Download the CA certificate bundle from the Settings tab of your Postgres service and provide it with Upload CA in the ClickPipe connection settings. This is the recommended option. See Verified TLS connection for where to find the bundle.
- Turn on Skip certificate verification in the ClickPipe connection settings. The connection stays encrypted but the server identity isn’t checked.
clickhousectl, fetch the bundle and pass it with --ca-certificate: