kafka.common.KafkaException:错误的请求类型18

时间:2018-11-25 05:53:58

标签: apache-spark apache-kafka spark-streaming

我正在运行这段代码。 StreamingInputDF是有关Kafka主题的readStream。我正在运行spark 2.4.0和Kafka 0.10.2

val activityQuery = streamingInputDF.writeStream
.format("console")
.outputMode("append")
.start()
.awaitTermination()

一旦在streamInputInputDF上调用writeStream,我就会看到Kafka代理抛出的此异常

[2018-11-24 21:46:42,842] ERROR Closing socket for /127.0.0.1 because of error (kafka.network.Processor)
kafka.common.KafkaException: Wrong request type 18
    at kafka.api.RequestKeys$.deserializerForKey(RequestKeys.scala:64)
    at kafka.network.RequestChannel$Request.<init>(RequestChannel.scala:50)
    at kafka.network.Processor.read(SocketServer.scala:450)
    at kafka.network.Processor.run(SocketServer.scala:340)
    at java.lang.Thread.run(Thread.java:745)

1 个答案:

答案 0 :(得分:0)

此问题已解决。现在,当它们进入Kafka主题时,我可以在spark shell中看到这些推文。我所做的只是重启Kafka经纪人,而没有其他任何改变。

val activityQuery = streamingInputDF.writeStream
.format("console")
.outputMode("append")
.start()
.awaitTermination()