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. )
To provide a user with replication permissions, define a PostgreSQL role that has at least the REPLICATION and LOGIN permissions, and then grant that role to the user. For example:
Configure the PostgreSQL server to logical replication with the pgoutput plugin
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.
If the user you provide the Peaka connection with has superuser permissions, the publication is created at start-up automatically, if it does not already exist.
b. You can create a publication for all of your tables.
Copy
Ask AI
CREATE PUBLICATION <publication_name> FOR ALL TABLES;
c. Alternatively, you can create a publication for only tables under the cached schema.
Copy
Ask AI
CREATE PUBLICATION <publication_name> FOR TABLES IN SCHEMA <schema_name>;