---
title: Debezium PostgreSQL Source 连接器变更捕获到 Kafka 实战
keywords: PostgresConnector, pgoutput, publication.autocreate.mode, slot.name, topic.prefix
description: 使用 Debezium PostgreSQL Source 连接器捕获数据库变更并写入 Kafka,配置复制槽与发布、表过滤与模式变更输出。
tags:
- Debezium
- Kafka
- PostgresConnector
- pgoutput
- publication.autocreate.mode
- slot.name
- topic.prefix
- 数据流
categories:
- 文章资讯
- 技术教程
---
连接器配置(debezium-postgres.json):
{
"name": "debezium-postgres-src",
"config": {
"connector.class": "io.debezium.connector.postgresql.PostgresConnector",
"tasks.max": "1",
"database.hostname": "pg",
"database.port": "5432",
"database.user": "replicator",
"database.password": "secret",
"database.dbname": "app",
"slot.name": "app_slot",
"publication.autocreate.mode": "filtered",
"plugin.name": "pgoutput",
"topic.prefix": "app",
"table.include.list": "public.users,public.orders",
"include.schema.changes": "true",
"decimal.handling.mode": "precise"
}
}
通过 REST 创建并查看状态:
curl -X POST -H "Content-Type: application/json" --data @debezium-postgres.json http://localhost:8083/connectors
curl http://localhost:8083/connectors/debezium-postgres-src/status

发表评论 取消回复