简体   繁体   English

如何为具有多个分区的 Kafka 主题启动多个使用者?

[英]How can I start multiple consumers for a Kafka topic with multiple partitions?

I have recently started using spark and have to deal with a case where I need to consume multiple partitions of a Kafka topic in spark.我最近开始使用 spark 并且必须处理我需要在 spark 中使用 Kafka 主题的多个分区的情况。 How can I start multiple consumers ?如何启动多个消费者? Do I need to have multiple instances of same application running using same group id ?我是否需要使用相同的组 ID 运行同一应用程序的多个实例? or is there any configuration I can make use of while starting application and it does that job internally?或者在启动应用程序时我可以使用任何配置并且它在内部完成这项工作?

Passing --num-executors and using more than one core per executor will make more than one consumer thread in Spark传递--num-executors并为每个 executor 使用一个以上的核心将在 Spark 中创建多个消费者线程

Each consumer thread gets mapped to a single partition.每个消费者线程都映射到一个分区。

Make the total threads equal the total partitions to maximize distributed throughput使总线程数等于总分区数以最大化分布式吞吐量

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM