【发布时间】:2023-03-10 11:52:01
【问题描述】:
我正在本地模式下使用 Spark 集群运行 PySpark,并且我正在尝试将流式 DataFrame 写入 Kafka 主题。
当我运行查询时,我收到以下消息:
java.lang.IllegalStateException: Set(topicname-0) are gone. Some data may have been missed..
Some data may have been lost because they are not available in Kafka any more; either the
data was aged out by Kafka or the topic may have been deleted before all the data in the
topic was processed. If you don't want your streaming query to fail on such cases, set the
source option "failOnDataLoss" to "false".
这是我的代码:
query = (
output_stream
.writeStream.format("kafka")
.option("kafka.bootstrap.servers", "localhost:9092")
.option("topic", "ratings-cleaned")
.option("checkpointLocation", "checkpoints-folder")
.start()
)
sleep(2)
print(query.status)
【问题讨论】:
标签: pyspark apache-kafka spark-structured-streaming spark-streaming-kafka