pgoutput logical replication plugin.
Prerequisites
- Administrator access to the Aptible Environment
- The Aptible CLI
- A Google Cloud project with billing enabled
- The Datastream API and BigQuery API enabled in Google Cloud
- A PostgreSQL Database on Aptible
Step 1: Configure Aptible Network Access
Create a Database Endpoint so Datastream can connect to your Database.Create a Database Endpoint
In the Aptible Dashboard, navigate to the Database, open the Endpoints tab, and create a TCP Endpoint. Keep the Endpoint host and port available for the Google Datastream setup.
Get Google Datastream IP addresses
In Google Cloud, navigate to Datastream > Connection Profiles > Create Profile. Select PostgreSQL, choose the region where the stream will run, select IP allowlisting as the connectivity method, and copy the static IP addresses Google provides.
Step 2: Configure PostgreSQL Replication
Use the defaultaptible database user to configure logical replication.
Create a local tunnel to your Database:
psql or another PostgreSQL client. Then run:
wal_sender_timeout = 0 prevents idle replication connections from timing out when Datastream keeps the WAL stream open through the Aptible load balancer.Step 3: Retrieve the Aptible CA Certificate
Download the Environment CA certificate so Google Datastream can verify the Database Endpoint certificate:aptible_ca.pem when creating the PostgreSQL source connection profile in Datastream.
Step 4: Create Datastream Connection Profiles
PostgreSQL Source
Create a PostgreSQL source connection profile in Google Datastream with these values:- Hostname: the Aptible Database Endpoint hostname, such as
elb-xxx.aptible.in - Port: the Aptible Database Endpoint port
- Username:
aptible - Password: the Database credential password
- Database name:
db, unless your Database uses a different name - Encryption: Require SSL/TLS
- Server verification: enabled
- CA certificate: upload
aptible_ca.pem - Connectivity: IP allowlisting
BigQuery Destination
Create a BigQuery destination connection profile in Datastream and select the Google Cloud project where replicated data should be written.Step 5: Create and Start the Stream
In Google Datastream, create a stream with the PostgreSQL source profile and BigQuery destination profile. Use these source configuration values:- Replication slot name:
datastream_slot - Publication name:
datastream_publication

