CMAK icon indicating copy to clipboard operation
CMAK copied to clipboard

Could not get offset when using KafkaUtils.createDirectStream with Spark Streaming

Open shenzhun opened this issue 10 years ago • 6 comments

Hi there, spark version: 1.6.0 scala: 2.10.4 EMR: 4.3.0

When I use KafkaUtils.createDirectStream with Spark Streaming to consumer data from Kafka, I could not see the consumer info from Kafka Manager.

Here is my setting code:

  val kafkaParams = Map[String, String]("bootstrap.servers" -> brokers, "group.id" -> "ss-test1")
  val topicsSet = topics.split(",").toSet
  val instream = KafkaUtils.createDirectStream[String, String, StringDecoder, StringDecoder](ssc, kafkaParams, topicsSet)

Thanks!

shenzhun avatar Mar 03 '16 10:03 shenzhun

DirectStream does not use ZooKeeper...

mariussoutier avatar Mar 04 '16 14:03 mariussoutier

You're right! But Kafka Manager supports 0.9.0.0, it should be OK for us to get the consumer group offset of Kafka (new consumer).

shenzhun avatar Mar 06 '16 06:03 shenzhun

Spark doesn't use the new consumer :) It saves the offsets in the checkpoint.

mariussoutier avatar Mar 06 '16 10:03 mariussoutier

I recheck the DirectStream details, as you said it saves the offsets in the checkpoint. It also provide a way to update Zookeeper by myself, but I could not understand it. Any advice ?

shenzhun avatar Mar 06 '16 14:03 shenzhun

You have to update ZooKeeper from code, check the HasOffetRange part in the official Spark Kafka documentation.

mariussoutier avatar Mar 06 '16 18:03 mariussoutier

@shenzhun please close if this is no longer an issue.

patelh avatar Mar 26 '16 20:03 patelh