---
title: Debezium MySQL Source 连接器变更捕获到 Kafka 实战
keywords: Debezium, MySQL Connector, CDC, topic.prefix, table.include.list, snapshot.mode
description: 使用 Debezium MySQL Source 连接器捕获数据库变更并写入 Kafka,配置主题前缀与表过滤及快照策略。
tags:
- CDC
- Debezium
- Kafka
- MySQL Connector
- snapshot.mode
- table.include.list
- topic.prefix
- 数据流
categories:
- 文章资讯
- 技术教程
---
连接器配置(debezium-mysql.json):
{
"name": "debezium-mysql-src",
"config": {
"connector.class": "io.debezium.connector.mysql.MySqlConnector",
"tasks.max": "1",
"database.hostname": "mysql",
"database.port": "3306",
"database.user": "replicator",
"database.password": "secret",
"database.allowPublicKeyRetrieval": "true",
"topic.prefix": "app",
"database.include.list": "app",
"table.include.list": "app.users,app.orders",
"include.schema.changes": "true",
"snapshot.mode": "initial",
"decimal.handling.mode": "precise"
}
}
通过 REST 创建并查看状态:
curl -X POST -H "Content-Type: application/json" --data @debezium-mysql.json http://localhost:8083/connectors
curl http://localhost:8083/connectors/debezium-mysql-src/status

发表评论 取消回复