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:
wal_levelto "logical" in your database configuration.
Restart the server.
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.
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');
Grant the necessary replication permission to your user to enable reading the logical replication slot:
ALTER user <user> with replication;
Grant SELECT permission on all tables in the schema to your user:
GRANT SELECT ON ALL TABLES IN SCHEMA <schema> TO <user>;
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.