Kafka的Spark流错误

bkhjykvo  于 2021-06-07  发布在  Kafka
关注(0)|答案(1)|浏览(379)

当我通过 spark-submit ,我收到关于kafka属性无效的警告消息:

VerifiableProperties: Property auto.offset.reset is overridden to largest
VerifiableProperties: Property enable.auto.commit is not valid.
VerifiableProperties: Property sasl.kerberos.service.name is not valid
VerifiableProperties: Property key.deserializer is not valid
...
VerifiableProperties: Property zookeeper.connect is overridden to ....

财产 zookeeper.connect 被正确地拾起。
下列属性怎么可能 kafkaParams.put("enable.auto.commit", "false"); …被视为无效?
在java代码中,我在hashmap中提供了kafka参数,并将其传递给 KafkaUtils.createDirectStream() 应用程序编程接口。我不知道为什么这些属性被警告无效。
当我试图打印 JavaPairInputDStream 作为 directStream.print(); 它引发异常:

java.io.EOFException: Received -1 when reading from channel, socket had likely been closed.

jaas.conf提供给spark submit命令

--conf "spark.executor.extraJavaOptions=-Djava.security.auth.login.config=jaas.conf"

private key和public key作为

--files jaas.conf,privatekey,publickey
8zzbczxx

8zzbczxx1#

我在同一个类中使用两个基于接收器的流进行测试

JavaPairReceiverInputDStream<String, byte[]> receiverStream = KafkaUtils.createStream(...);

…和直接流作为

JavaPairInputDStream<String, byte[]> directStream = KafkaUtils.createDirectStream(...);

从这里找到一些必需的更改:
https://community.hortonworks.com/questions/6332/how-to-read-from-a-kafka-topic-using-spark-streami.html
看起来,只有基于接收器的流才能与给定的软件堆栈版本一起工作。
但是,来自 VerifiableProperties 还是会来的。这个问题还没有解决。

相关问题