我正在阅读下面的 Databricks 博客
https://databricks.com/blog/2015/03/30/improvements-to-kafka-integration-of-spark-streaming.html
在解释 spark kafka 集成如何使用接收器和 WAl 工作的过程时,它说
1.The Kafka data is continuously received by Kafka Receivers running in the Spark workers/executors. This used the high-level consumer API of Kafka.
2.The received data is stored in Spark’s worker/executor memory as well as to the WAL (replicated on HDFS). The Kafka Receiver updated Kafka’s offsets to Zookeeper only after the data has been persisted to the log.
现在我的疑问是高级消费者如何更新 zookeeper 中的偏移量,因为高级消费者不处理偏移量,它由 zookeeper 处理。因此,一旦我们使用 zookeeper 从 kafka 读取消息,zookeeper 就会自动更新偏移量。
最佳答案
因此,当消费者从 kafka 中的特定主题检索数据时,消费者有责任更新 zookeeper 中的偏移量。因此,当您使用自定义 kafka 消费者时,它有一个内置的 kafka API(org.apache.kafka.clients.consumer.* 这样做),一旦您收到来自该特定主题的数据,它就会更新偏移量。
对于 spark 中基于接收器的方法,它使用 Kafka 的高级 API 来更新 zookeeper 中的偏移量。
关于hadoop - 使用接收器和 WAL 的 Spark Kafka 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44846976/