confluent 5.4.0 elasticsearch接收器连接器中没有连接器类型错误

wmomyfyw  于 2021-06-04  发布在  Kafka
关注(0)|答案(1)|浏览(460)

我在我的Kafka主题“演示twitter状态”中引入了来自twitter源连接器的数据
我想把这个放进ElasticSearch。我做的连接器是这样的:

curl -k -X POST  http://xxxxxxxxxx:8083/connectors -H "Content-Type: application/json" --data '{
  "name":"sink-elasticsearch-connector1",
  "config":{
    "tasks.max": "2",
    "topics":"demo-twitter-status",
    "key.converter":"org.apache.kafka.connect.json.JsonConverter",
    "key.converter.schema.enable":"true",
    "value.converter":"org.apache.kafka.connect.json.JsonConverter",
    "value.converter.schema.enable":"true",
    "connection.url":"http://xxxxxxxx:9200",
    "type.name":"kafka-connect",
    "key.ignore":"true"
    }
}'

这是一个错误:

{
  "error_code": 400,
  "message": "Connector config {type.name=kafka-connect, key.converter.schema.enable=true, tasks.max=2, topics=demo-twitter-status,
   value.converter.schema.enable=true, name=sink-elasticsearch-connector1, value.converter=org.apache.kafka.connect.json.JsonConverter,
   connection.url=http://===========:9200, key.ignore=true, key.converter=org.apache.kafka.connect.json.JsonConverter}
   contains no connector type"
}

我用过 "type.name":"kafkaconnect" and "type.name":"_doc" 同样的错误也出现了。
谁能帮我修一下接头吗。提前谢谢!!!!
版本如下:
汇合5.4.0
elasticsearch 7.6版
ps:confluent文档说confluent 5.4.0支持7.x

2sbarzqh

2sbarzqh1#

原因显示在您的错误中:

Connector config …   contains no connector type

您需要指定connector.class,以便kafka connect知道如何使用elasticsearch接收器连接器。
尝试

curl -k -X POST  http://xxxxxxxxxx:8083/connectors -H "Content-Type: application/json" --data '{
  "name":"sink-elasticsearch-connector1",
  "config":{
    "connector.class":  "io.confluent.connect.elasticsearch.ElasticsearchSinkConnector",
    "tasks.max": "2",
    "topics":"demo-twitter-status",
    "key.converter":"org.apache.kafka.connect.json.JsonConverter",
    "key.converter.schema.enable":"true",
    "value.converter":"org.apache.kafka.connect.json.JsonConverter",
    "value.converter.schema.enable":"true",
    "connection.url":"http://xxxxxxxx:9200",
    "type.name":"kafka-connect",
    "key.ignore":"true"
    }
}'

相关问题