How to setup CDC PostgreSQL
To setup CDC between your PostgreSQL database and Peaka Big Table, you need:
Create a database user for Peaka's exclusive use that can perform replication.
( Although, by default, superusers have the necessary REPLICATION and LOGINroles, you can create another user that has the minimum required privileges. )
CREATE ROLE <role> REPLICATION LOGIN;
Set the wal_level parameter in your database configuration to logical. For a standard PostgreSQL database, do this by adding a wal_level = logical line to the postgresql.conf file. Restart the server for this change to take effect.
Ensure that your max_replication_slots value is equal to or higher than the number of PostgreSQL connectors that use WAL plus the number of other replication slots your database uses.
Create a publication for your tables.
b. You can create a publication for all of your tables.
CREATE PUBLICATION <publication_name> FOR ALL TABLES;
c. Alternatively, you can create a publication for only tables under the cached schema.
CREATE PUBLICATION <publication_name> FOR TABLES IN SCHEMA <schema_name>;
Create a logical replication slot (Optional)
SELECT pg_create_logical_replication_slot(<slot_name>, 'pgoutput');
Note: since a replication slot can only be used by a single connector, it is essential to create a unique replication slot for each CDC connection.