Debezium-不包含连接器类型

Posted

技术标签:

【中文标题】Debezium-不包含连接器类型【英文标题】:Debezium-contains no connector type 【发布时间】:2019-05-08 21:08:42 【问题描述】:

我正在尝试使用 Debezium 连接到我本地机器上的 mysql 数据库。

尝试使用以下命令调用 kafka: sudo kafka/bin/connect-standalone.shsh kafka/config/connect-standalone.properties kafka/config/connector.properties

这是connector.properties中的配置:


  "name": "inventory-connector",
  "config": 
    "connector.class": "io.debezium.connector.mysql.MySqlConnector",
    "database.hostname": "127.0.0.1",
    "tasks.max": "1",
    "database.port": "3306",
    "database.user": "debezium",
    "database.password": "Password@123",
    "database.server.id": "1",
    "database.server.name": "fullfillment",
    "database.whitelist": "inventory",
    "database.history.kafka.bootstrap.servers": "localhost:9092",
    "database.history.kafka.topic": "dbhistory.fullfillment",
    "include.schema.changes": "true",
    "type": "null"
  

运行上述命令时出现以下错误:

[2018-12-07 10:58:17,102] ERROR Stopping after connector error (org.apache.kafka.connect.cli.ConnectStandalone:113)
java.util.concurrent.ExecutionException: org.apache.kafka.connect.runtime.rest.errors.BadRequestException: Connector config "config"=, "type"="null", "database.user"="debezium",, "database.port"="3306",, "include.schema.changes"="true",, "database.server.name"="fullfillment",, "connector.class"="io.debezium.connector.mysql.MySqlConnector",, "tasks.max"="1",, "database.history.kafka.topic"="dbhistory.fullfillment",, "database.server.id"="1",, "database.whitelist"="inventory",, "name"="inventory-connector",, "database.hostname"="127.0.0.1",, =, "database.password"="Password@123",, =, "database.history.kafka.bootstrap.servers"="localhost:9092", contains no connector type
    at org.apache.kafka.connect.util.ConvertingFutureCallback.result(ConvertingFutureCallback.java:79)
    at org.apache.kafka.connect.util.ConvertingFutureCallback.get(ConvertingFutureCallback.java:66)
    at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:110)
Caused by: org.apache.kafka.connect.runtime.rest.errors.BadRequestException: Connector config "config"=, "type"="null", "database.user"="debezium",, "database.port"="3306",, "include.schema.changes"="true",, "database.server.name"="fullfillment",, "connector.class"="io.debezium.connector.mysql.MySqlConnector",, "tasks.max"="1",, "database.history.kafka.topic"="dbhistory.fullfillment",, "database.server.id"="1",, "database.whitelist"="inventory",, "name"="inventory-connector",, "database.hostname"="127.0.0.1",, =, "database.password"="Password@123",, =, "database.history.kafka.bootstrap.servers"="localhost:9092", contains no connector type
    at org.apache.kafka.connect.runtime.AbstractHerder.validateConnectorConfig(AbstractHerder.java:259)
    at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.putConnectorConfig(StandaloneHerder.java:189)
    at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:107)

我们将不胜感激任何帮助。

【问题讨论】:

【参考方案1】:

connector.properites 用于独立模式需要属性文件格式。所以请把config 部分改写为

connector.class=io.debezium.connector.mysql.MySqlConnector
.
.
.

【讨论】:

【参考方案2】:

您有一个 JSON 文件,而不是属性文件。

这意味着与connect-distributed 模式一起使用。并通过 HTTP 发布到 Kafka Connect REST API,而不是作为 CLI 参数。

对于connect-standalone,您同时提供 Connect worker 属性 connector 属性文件,如 Java @987654323 @ 文件。

【讨论】:

以上是关于Debezium-不包含连接器类型的主要内容,如果未能解决你的问题,请参考以下文章

如何删除 debezium 连接器

多个 Debezium Source 连接器一次不工作

使用 Ctrl+C 停止 Debezium 连接器并再次重新启动连接器后连接器不起作用

在 Debezium 1.5 中使用过滤器变换

Debezium Kafka 连接器 mongodb

为数据库中的多个表配置 debezium 连接器