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:
-
Installed and configured Kafka and Debezium.
-
Verified that the PostgreSQL database has wal_level set to logical.
- User Permission
- 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?
2
Answers
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-permissionsThe permissions and replication/publication should be configured properly.
For instance, you can create publication for Debezium user like: