AlloyDB for PostgeSQL

This guide walks you through every step of connecting an AlloyDB for PostgreSQL instance to Revos so that Change Data Capture (CDC) runs reliably from day one.

Connecting AlloyDB for PostgreSQL in RevOS

This guide walks you through every step of connecting an AlloyDB for PostgreSQL instance to RevOS so that Change Data Capture (CDC) runs reliably from day one.

What you need before you start

  • Hostname of the AlloyDB instance (see Instances → Connection info in the Google Cloud console)
  • Port — typically 5432
  • Database name
  • Username and password that can read data and replicate
  • Access to run SQL on the database (to create a replication slot and publication)
Notion image
Why replication is required

Step 1. Enable logical replication in AlloyDB

AlloyDB must be started with wal_level = logical.

  1. Console (UI)
    1. Open your cluster → Instance → Flags → Add flag → wal_level = logical → Save & restart.

  1. gcloud CLI (same result, handy for automation):
    1. gcloud alloydb instances update INSTANCE_ID \
        --cluster=CLUSTER_ID \
        --database-flags wal_level=logical
      

After the instance restarts, verify the setting:

SHOW wal_level;         -- should output "logical"

Step 2. Create a replication slot and publication

Connect to the database with psql, DBeaver, or any SQL client.

-- 1. replication slot
SELECT pg_create_logical_replication_slot('RevOS_slot', 'pgoutput');

-- 2. publication (all tables by default)
CREATE PUBLICATION RevOS_pub FOR ALL TABLES;

Use different names if you prefer – just remember them for Step 3.

Grant replication permissions if the user does not already have them:

ALTER ROLE RevOS_user WITH REPLICATION;   -- requires admin privileges

Step 3. Fill out the connection form in RevOS

Add a new source → AlloyDB for PostgreSQL and populate the fields as follows.

Section
Field
What to enter
Basic
Name
Any label (e.g. AlloyDB‑Prod)
Host
AlloyDB host
Port
5432 unless you changed it
Database Name
Target database
Username / Password
Account with read + replication rights
Optional
Schemas
public (default) or another schema
JDBC URL Parameters
Leave blank unless you need custom driver options
Security
SSL Mode
require (minimum) or verify-fullAlloyDB always uses TLS; disable will fail unless you connect to a local test server.
CDC
Update Method
Read Changes using Write‑Ahead Log (CDC) (recommended) Choose Detect Changes with Xmin only for very small/ephemeral databases; User Defined Cursor is for custom SQL polling.
Plugin
pgoutput (mandatory for AlloyDB)
Replication Slot
Publication
Initial Waiting Time
300 s (increase if your first sync is huge)
Queue Size
10000 (raise for sustained high‑volume streams)

Step 4. (Optional) Set up an SSH tunnel

Notion image

If the database is not reachable from the RevOS network (e.g. private VPC, no public IP):

  1. SSH Key Authentication or SSH Password Authentication
  1. Provide SSH host, port (usually 22), and tunnel user credentials.

Checklist before falling back to SSH

  • Public or private IP/firewall rules allow inbound traffic on 5432
  • RevOS workers share a VPC or have a VPC‑peering route
  • AlloyDB authorized networks include the RevOS egress range

Only enable SSH if direct TLS connectivity is impossible.


Step 5. Test and connect

Click Connect.

RevOS will validate credentials, network reachability, replication slot, and publication.

If the test succeeds, the source becomes active and RevOS starts the initial sync.


Common issues and fixes

Symptom
Likely cause
Fix
connection refused
Wrong host/port or firewall
Double‑check host, open port 5432, or configure SSH.
FATAL: password authentication failed
Wrong user or password
Re‑enter credentials; test them with psql.
ERROR: logical decoding requires wal_level >= logical
Flag not set
Repeat Step 1, then restart instance.
ERROR: replication slot "RevOS_slot" does not exist
Slot name mismatch
Verify name (pg_replication_slots) or recreate slot.
TLS handshake errors
SSL mode mismatch
Use require or verify-full; ensure CA certificates are trusted.

Useful queries while debugging:

-- List replication slots
SELECT slot_name, active FROM pg_replication_slots;

-- Drop a stale slot
SELECT pg_drop_replication_slot('RevOS_slot');

Final notes

  • RevOS does not create replication slots or publications automatically; they must exist prior to connecting.
  • The PostgreSQL user must have:
    • Access to the relevant schemas/tables
    • The REPLICATION attribute (or equivalent IAM role)
  • AlloyDB does not expose superuser accounts; the built‑in alloydb_admin role is usually sufficient.

Follow the steps above and your connector should be ready in a few minutes.

If you encounter problems not covered here, contact RevOS support — we’re happy to help.

Did this answer your question?
😞
😐
🤩

Last updated on May 5, 2025