skip to Main Content

I’m trying to set up Change Data Capture (CDC) from a PostgreSQL database to Kafka using Debezium. I have successfully configured Debezium for CDC from a MySQL database, but I’m encountering issues when attempting to connect to a PostgreSQL database.

Here are the steps I’ve taken so far:

  1. Installed and configured Kafka and Debezium.

  2. Verified that the PostgreSQL database has wal_level set to logical.

wal_level set to logical

  1. User Permission

User Permission

  1. Configured Debezium PostgreSQL connector with the appropriate settings.
{
  "name": "postgres-connector",
  "config": {
    "connector.class": "io.debezium.connector.postgresql.PostgresConnector",
    "tasks.max": "1",
    "database.hostname": "localhost",
    "database.port": "5432",
    "database.user": "myadmin",
    "database.password": "123",
    "database.dbname": "source_db",
    "database.server.name": "etltask",
    "table.include.list": "source_db.source_table",
    "database.history.kafka.bootstrap.servers": "localhost:9092",
    "database.history.kafka.topic": "schema-changes.source_db",
    "topic.prefix": "etltask"
  }
}

However, when attempting to start the Debezium connector task, I encounter the following error. How to resolve this error and setup a CDC from postgres to Kafka using debezium?

Creation of replication slot failed

2

Answers


  1. Usually this means that the debezium user does not have the proper permissions in the db. Have a look at: https://debezium.io/documentation/reference/stable/connectors/postgresql.html#postgresql-permissions

    Login or Signup to reply.
  2. The permissions and replication/publication should be configured properly.
    For instance, you can create publication for Debezium user like:

    create publication dbz_publication;
    alter publication dbz_publication owner to myadmin;
    alter publication dbz_publication add table source_db.source_table;
    alter table if exists source_db.source_table replica identity full;
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search