我在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:合并文档说7.x支持合并5.4.0
错误中显示了原因:
Connector config … contains no connector type
您需要指定连接器.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"
}
}'