我在Kafka主题“demo-twitter-status” 中从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

flex 搜寻7.6

PS:汇合的文档说汇合的5.4.0支持7.x。

最佳答案

原因显示在您的错误中:

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"
    }
}'

关于elasticsearch - Confluent 5.4.0 ElasticSearch Sink连接器中没有连接器类型错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/60985804/

10-12 19:55