【发布时间】:2020-09-05 11:57:45
【问题描述】:
我的 Kafka Connect 位于 Kubernetes 集群中,该集群的连接器文件夹中有 mongo-kafka-connect-1.1.0-all.jar。
我已将 Kafka Connect 服务端口转发到我的本地主机,并尝试使用此 curl 命令上传 Mongo Sink 连接器的属性(显然,在相关的 <> 位置中包含我自己的连接详细信息):
curl -X PUT http://localhost:8083/connectors/sink-mongodb/config -H "Content-Type: application/json" -d '{
"connector.class":"com.mongodb.kafka.connect.MongoSinkConnector",
"tasks.max":"1",
"topics":"<topic name>",
"connection.uri":"mongodb://<username>:<password>@<uri1>:<port1>,<uri2>:<port2>",
"database":"<database name>",
"collection":"<collection name>",
"key.converter":"org.apache.kafka.connect.storage.StringConverter",
"key.converter.schemas.enable":false,
"value.converter":"org.apache.kafka.connect.json.JsonConverter",
"value.converter.schemas.enable":false
}'
但是,我收到以下错误响应:
{"error_code":400,"message":"Connector configuration is invalid and contains the following 1 error(s):\nConfiguration is not defined: topic\nUnable to connect to the server.\nYou can also find the above list of errors at the endpoint `/{connectorType}/config/validate`"}
我的配置错了吗,我错过了什么吗?
【问题讨论】:
-
可能只是一个错字:在你的命令中使用
topics而不是topic。 -
感谢@mike 的建议,但绝对是
topics。如果我将其更改为topic,则会收到错误消息:{"error_code":500,"message":"Must configure one of topics or topics.regex"} -
您找到问题了吗?我面临同样的问题,无法找出解决方案@David
-
@yantrakaar 不幸的是,不是!我暂时不得不离开这个问题,专注于其他不受此阻碍的事情。除非我得到某人的帮助,否则我很可能需要找出一种可能不使用 Kafka Connect 的替代方法。也许通过编写一个生产和消费的 FaaS,但这不是首选,因为它会失去 Kafka Connect 的好处。
-
@David 在我的情况下,connection.uri 参数失败,因此 error_count 为 1。发送验证响应时似乎存在错误。因此即使验证成功,值“未定义配置:主题”也始终附加在验证响应中。
标签: mongodb apache-kafka apache-kafka-connect mongodb-kafka-connector