【问题标题】:Failed to flush WorkerSourceTask{id=local-file-source-0},timed out while waiting for producer to flush outstanding messages, 1 left无法刷新 WorkerSourceTask{id=local-file-source-0},等待生产者刷新未完成的消息时超时,还剩 1 个
【发布时间】:2022-01-17 12:49:07
【问题描述】:

我正在关注这个 github 仓库

https://github.com/hannesstockner/kafka-connect-elasticsearch/

我正在尝试将数据从文件源读取到弹性搜索中

运行standalone.sh 脚本时出现错误

Failed to flush WorkerSourceTask{id=local-file-source-0}, timed out while waiting for producer to flush outstanding messages, 1 left ({ProducerRecord(topic=recipes, partition=null, key=null, value=[B@6704e57f=ProducerRecord(topic=recipes, partition=null, key=null, value=[B@6704e57f})

这些是我的配置:

连接-elasticsearch-sink.properties

name=local-elasticsearch-sink
connector.class=com.hannesstockner.connect.es.ElasticsearchSinkConnector
tasks.max=1
es.host=10.200.10.1
topics=recipes
index.prefix=kafka_

连接文件源.properties

name=local-elasticsearch-sink
connector.class=com.hannesstockner.connect.es.ElasticsearchSinkConnector
tasks.max=1
es.host=10.200.10.1
topics=recipes
index.prefix=kafka_

connect-standalone.properties

bootstrap.servers=10.200.10.1:9092

key.converter=org.apache.kafka.connect.json.JsonConverter
value.converter=org.apache.kafka.connect.json.JsonConverter
key.converter.schemas.enable=false
value.converter.schemas.enable=false

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=/tmp/connect.offsets
# Flush much faster than normal, which is useful for testing/debugging
#offset.flush.interval.ms=20000
offset.flush.timeout.ms=20000

和码头配置:

kafka:
  image: flozano/kafka:0.9.0.0
  ports:
    - "2181:2181"
    - "9092:9092"
  environment:
    ADVERTISED_HOST: ${DOCKER_IP}
elasticsearch:
  image: elasticsearch:2.1
  ports:
    - "9200:9200"
    - "9300:9300"

我尝试在我的standlone.properties 文件中设置offset.flush.timeout.ms=20000 和producer.buffer.memory=10,但没有成功:

Kafka Connect - Failed to flush, timed out while waiting for producer to flush outstanding messages

【问题讨论】:

  • 那个 repo 已经 6 年没有更新过了。它与 Elastic 实际支持的“真实”kafka-connect-elasticsearch 究竟有何不同?除此之外,FileSourceConnector 并不是真正要使用的。

标签: elasticsearch apache-kafka apache-kafka-connect


【解决方案1】:

如果您想将文件读入 Elastic(或 Kafka),最好使用 Filebeat。

FileSourceConnector 被记录为示例,而不是生产级产品。同时,还有其他连接器,如“Spooldir 连接器”或“kafka-connect-fs”项目

此外,实际支持并积极开发的 Elasticsearch Kafka 连接器是here

另外,您应该使用一个不同的 Kafka Docker 镜像,该镜像也得到维护并且是最新的(例如来自 bitnami 或 confluentinc 的镜像),您可以将其与 Docker Kafka Connect 镜像 such as mine 一起使用,而不是读取本地文件。

您的 Elasticsearch docker 镜像版本也是 6 年以上。

【讨论】:

    猜你喜欢
    • 2019-08-26
    • 1970-01-01
    • 2018-06-08
    • 1970-01-01
    • 2014-10-16
    • 1970-01-01
    • 1970-01-01
    • 2013-08-14
    • 1970-01-01
    相关资源
    最近更新 更多