Setting up CDC for Hosted Postgres

Before you start:

  • CDC for Postgres requires additional log storage. Though unlikely, failed replication due to a lost connection can cause logs to remain on the server. If logs do accumulate on the server, drop and recreate the replication slot. Notify Alooma if this happens so that we can recover any possible gaps in the data.

  • Make sure you're using Postgres version 9.4 or newer.


You cannot have multiple Postgres CDC inputs referencing the same replication slot.

Perform the following steps in your master database:

  1. Set wal_level to "logical" in your database configuration. 

  2. Restart the server.

  3. Create a dedicated Logical Replication slot.


    You must create a dedicated replication slot for Alooma. If any other processes use this replication slot, you risk losing data.

    1. Log into postgresSql as a superuser and, using the test_decoding plugin, create a logical replication slot named: alooma_replication_slot

      SELECT pg_create_logical_replication_slot('alooma_replication_slot', 'test_decoding');
    2. Grant the necessary replication permission to your user to enable reading the logical replication slot:

      ALTER user <user> with replication;
    3. Grant SELECT permission on all tables in the schema to your user:

    4. Log in as the user and verify you can read from the logical replication slot:

      SELECT count(*) FROM pg_logical_slot_peek_changes('alooma_replication_slot', null, null);

And that's it! You're all set to finish connecting to Postgres.

Search results

    No results found