Kafka客户线程,任务,分区?

时间:2018-01-11 03:01:03

标签: multithreading apache-kafka consumer

我有一个有3台机器的kafka集群。一个主题有6个分区(每台机器2个分区)。 当我启动一个具有6个消费者线程并属于一个组的消费者应用程序时。我知道一个消费者线程将被分配一个分区。 我想知道的是:消费者线程的任务将在分区上的机器上运行?或者将在应用程序被淘汰的机器上运行?

1 个答案:

答案 0 :(得分:1)

The model your are talking about sounds like the one we have with Apache Spark where workers for processing data run on worker nodes coordinated by a driver application on a the developer/user machine. Kafka doesn't work in this way. Kafka brokers are independent from the Kafka application(s) where consumers run for getting messages from topics/partitions. Where you start your consumer application(s) that is the machine where the application runs; it doesn't run on the broker nodes. The application with related consumers will connect to the "remote" broker nodes for getting messages. It's also true that you can just run your Kafka application(s) on a broker node just as another JVM process but it's not the model you describe above (as I said is much more like Apache Spark)