MongoDb Debezium-“连接器配置不包含连接器类型”

时间:2018-12-27 15:50:17

标签: apache-kafka apache-kafka-connect debezium

我正在尝试为Kafka和debezium做POC。

我已经启动了kafka和zookeeper,并且它们正在工作...现在,当我尝试加载kafka-connect时(我对此很陌生...),我收到此错误,我只是无法理解我的意思做错了。

注意:我已经使用Debezium教程docker映像对所有这些进行了测试,但是我想从远程服务器连接,并且我认为在没有docker的情况下安装所有内容会更容易进行配置

使用以下命令启动连接

./connect-standalone.sh ~/kafka/config/connect-standalone.properties ~/kafka/config/connect-standalone-worker.properties ~/kafka/config/debezium-connector.properties

connect-standalone.properties

bootstrap.servers=localhost:9092
key.converter.schemas.enable=true
value.converter.schemas.enable=true
offset.flush.interval.ms=10000
plugin.path=/home/ubuntu/kafka/plugins

connect-standalone-worker.properties

internal.key.converter=org.apache.kafka.connect.json.JsonConverter
internal.value.converter=org.apache.kafka.connect.json.JsonConverter
internal.key.converter.schemas.enable=false
internal.value.converter.schemas.enable=false
offset.storage.file.filename=/home/user/offest
value.converter=org.apache.kafka.connect.json.JsonConverter
key.converter=org.apache.kafka.connect.json.JsonConverter

debezium-connector.properties

name=my-connector
connector.class=io.debezium.connector.mongodb.MongoDbConnector
include.schema.changes=false
mongodb.name=mymongo
collection.whitelist=my.collection
tasks.max=1
mongodb.hosts=A.B.C.D:27017

运行连接时,我得到以下信息:

[2018-12-27 15:31:41,995] ERROR Failed to create job for /home/ubuntu/kafka/config/connect-standalone-worker.properties (org.apache.kafka.connect.cli.ConnectStandalone:102)
[2018-12-27 15:31:41,996] 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 {internal.key.converter=org.apache.kafka.connect.json.JsonConverter, offset.storage.file.filename=/home/user/offest, internal.value.converter.schemas.enable=false, internal.value.converter=org.apache.kafka.connect.json.JsonConverter, value.converter=org.apache.kafka.connect.json.JsonConverter, internal.key.converter.schemas.enable=false, key.converter=org.apache.kafka.connect.json.JsonConverter} 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 {internal.key.converter=org.apache.kafka.connect.json.JsonConverter, offset.storage.file.filename=/home/user/offest, internal.value.converter.schemas.enable=false, internal.value.converter=org.apache.kafka.connect.json.JsonConverter, value.converter=org.apache.kafka.connect.json.JsonConverter, internal.key.converter.schemas.enable=false, key.converter=org.apache.kafka.connect.json.JsonConverter} 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)
[2018-12-27 15:31:41,997] INFO Kafka Connect stopping (org.apache.kafka.connect.runtime.Connect:65)

1 个答案:

答案 0 :(得分:1)

connect-standalone.propertiesconnect-standalone-worker.properties必须是一个文件。

错误是说connect-standalone-worker.properties没有connector.class的值(之所以不应该是因为它是辅助属性,而不是连接器)


您要运行的命令应类似于

connect-standalone worker.properties connector1.properties [connector2.properties ... ]