问题
So my question is this: If i have a server running Kafka (And zookeeper), and another machine only consuming messages, does the consumer machine need to run zookeeper too? Or does the server take care of all?
回答1:
No.
Role of Zookeeper in Kafka is:
- Broker registration: (cluster membership) with heartbeats mechanism to keep the list current
- Storing topic configuration: which topics exist, how many partitions each has, where are the replicas, who is the preferred leader, list of ISR for partitions
- Electing controller: The controller is one of the brokers and is responsible for maintaining the leader/follower relationship for all the partitions.
So Zookeeper is required only for kafka broker. There is no need to have Zookeper on the producer or consumer side.
回答2:
The consumer does not need zookeeper
回答3:
You have not mentioned which version of Kafka or the clients you're using.
Kafka consumers using 0.8 store their offsets in Zookeeper, so it is required for them. However, no, you would not run Zookeeper and consumers on the same server
From 0.9 and later, clients are separate from needing it (unless you want to manage external connections to Zookeeper on your own for storing data)
来源:https://stackoverflow.com/questions/59771559/does-a-kafka-consumer-machine-need-to-run-zookeeper