首页 > 解决方案 > 删除“table.include.list”不会强制 Debezium 为数据库中的其余表创建主题

问题描述

我创建了 Debezium 连接器,它就像一个魅力:

{
    "name": "debezium_title",
    "config": {
        "connector.class": "io.debezium.connector.mysql.MySqlConnector",
        "tasks.max": "1",
        "database.hostname": "xxx.xxx.xxx",
        "database.port": "3306",
        "database.user": "kafkaconnect",
        "database.password": "***",
        "database.server.name": "mysql_debezium",
        "heartbeat.interval​.ms": 5000,
        "snapshot.mode": "when_needed",
        "snapshot.new.tables": "parallel",
        "database.include.list": "database",
        "table.include.list": "database.table1,database.table2",
        "database.history.kafka.topic": "mysql_debezium_history",
        "database.history​.kafka.recovery​.poll.interval.ms": 5000,
        "database.history.kafka.bootstrap.servers": "xxx.xxx.xxx:9092",
        "include.schema.changes": "false",
        "transforms": "extractInt",
        "transforms.extractInt.type": "org.apache.kafka.connect.transforms.ExtractField$Key",
        "transforms.extractInt.field": "id"
    }
}

现在,我想删除此连接器并创建一个没有表白名单的新连接器 - 以摄取整个数据库:

{
    "name": "debezium_title_new",
    "config": {
        "connector.class": "io.debezium.connector.mysql.MySqlConnector",
        "tasks.max": "1",
        "database.hostname": "xxx.xxx.xxx",
        "database.port": "3306",
        "database.user": "kafkaconnect",
        "database.password": "***",
        "database.server.name": "mysql_debezium_new",
        "heartbeat.interval​.ms": 5000,
        "snapshot.mode": "initial",
        "database.include.list": "database",
        "database.history.kafka.topic": "debezium_mysql_history_new",
        "database.history​.kafka.recovery​.poll.interval.ms": 5000,
        "database.history.kafka.bootstrap.servers": "xxx.xxx.xxx:9092"
    }
}

带有新的:连接器名称、数据库服务器名称和数据库历史 kafka 主题名称。

奇怪的是,它只为我"table.include.list"为第一个连接器设置的表格创建了主题!

kafka-topics --list --zookeeper xxx.xxx:2181

mysql_debezium_new.table1
mysql_debezium_new.table2

一段时间后发生错误: Encountered change event for table database.table3 whose schema isn't known to this connector(table3 是数据库中表的示例,它不在第一个连接器的白名单中)

我的数据库中的其余表在哪里?:) 当我已经拥有带有表白名单的连接器时,如何强制 Debezium 从 mysql 中移动所有表(删除第一个连接器并创建没有白名单的新连接器无济于事)。

我也尝试将新表添加到白名单,但它也不起作用 - 它不会创建新主题并且不会加载整个表 - 它等待表中的第一条新记录,然后发生错误:架构不是知道这张桌子。

那个怎么样?Debezium 是否为第一个连接器拍摄数据库快照,然后将其保存在某个地方并保留它?我怎样才能重置它?

Debezium 版本:1.5

标签: mysqlapache-kafka-connectdebezium

解决方案


该参数是可选的,如果您希望它获取所有非系统表,则完全忽略该参数。

来自文档: 可选的以逗号分隔的正则表达式列表,与您希望 Debezium 捕获的表的完全限定表标识符匹配;未包含在 table.include.list 中的任何表都将从捕获中排除。每个标识符的格式为 schemaName.tableName。默认情况下,连接器会捕获指定模式的所有非系统表。不得与 table.exclude.list 一起使用。

链接到上述 Debezium 文档:https ://debezium.io/documentation/reference/connectors/sqlserver.html


推荐阅读