Is Zookeeper a must for Kafka?

后端 未结 12 1531
遇见更好的自我
遇见更好的自我 2020-12-04 06:58

In Kafka, I would like to use only a single broker, single topic and a single partition having one producer and multiple consumers (each consumer getting its own copy of dat

相关标签:
12条回答
  • 2020-12-04 07:02

    Yes, Zookeeper is must by design for Kafka. Because Zookeeper has the responsibility a kind of managing Kafka cluster. It has list of all Kafka brokers with it. It notifies Kafka, if any broker goes down, or partition goes down or new broker is up or partition is up. In short ZK keeps every Kafka broker updated about current state of the Kafka cluster.

    Then every Kafka client(producer/consumer) all need to do is connect with any single broker and that broker has all metadata updated by Zookeeper, so client need not to bother about broker discovery headache.

    0 讨论(0)
  • 2020-12-04 07:03

    Other than the usual payload message transfer, there are many other communications that happens in kafka, like

    • Events related to brokers requesting the cluster membership.
    • Events related to Brokers becoming available.
    • Getting bootstrap config setups.
    • Events related to controller and leader updates.
    • Help status updates like Heartbeat updates.

    Zookeeper itself is a distributed system consisting of multiple nodes in an ensemble. Zookeeper is centralised service for maintaining such metadata.

    0 讨论(0)
  • 2020-12-04 07:04

    IMHO Zookeeper is not an overhead but makes your life a lot easier.

    It is basically used to maintain co-ordination between different nodes in a cluster. One of the most important things for Kafka is it uses zookeeper to periodically commit offsets so that in case of node failure it can resume from the previously committed offset (imagine yourself taking care of all this by your own).

    Zookeeper also plays a vital role for serving many other purposes, such as leader detection, configuration management, synchronization, detecting when a new node joins or leaves the cluster, etc.

    Future Kafka releases are planning to remove the zookeeper dependency but as of now it is an integral part of it.

    Here are a few lines taken from their FAQ page:

    Once the Zookeeper quorum is down, brokers could result in a bad state and could not normally serve client requests, etc. Although when Zookeeper quorum recovers, the Kafka brokers should be able to resume to normal state automatically, there are still a few corner cases the they cannot and a hard kill-and-recovery is required to bring it back to normal. Hence it is recommended to closely monitor your zookeeper cluster and provision it so that it is performant.

    For more details check here

    0 讨论(0)
  • 2020-12-04 07:05

    Kafka is built to use Zookeeper. There is no escaping from that.

    Kafka is a distributed system and uses Zookeeper to track status of kafka cluster nodes. It also keeps track of Kafka topics, partitions etc.

    Looking at your question, it seems you do not need Kafka. You can use any application that supports pub-sub such as Redis, Rabbit MQ or hosted solutions such as Pub-nub.

    0 讨论(0)
  • 2020-12-04 07:06

    As explained by others, Kafka (even in most recent version) will not work without Zookeeper.

    Kafka uses Zookeeper for the following:

    Electing a controller. The controller is one of the brokers and is responsible for maintaining the leader/follower relationship for all the partitions. When a node shuts down, it is the controller that tells other replicas to become partition leaders to replace the partition leaders on the node that is going away. Zookeeper is used to elect a controller, make sure there is only one and elect a new one it if it crashes.

    Cluster membership - which brokers are alive and part of the cluster? this is also managed through ZooKeeper.

    Topic configuration - which topics exist, how many partitions each has, where are the replicas, who is the preferred leader, what configuration overrides are set for each topic

    (0.9.0) - Quotas - how much data is each client allowed to read and write

    (0.9.0) - ACLs - who is allowed to read and write to which topic (old high level consumer) - Which consumer groups exist, who are their members and what is the latest offset each group got from each partition.

    [from https://www.quora.com/What-is-the-actual-role-of-ZooKeeper-in-Kafka/answer/Gwen-Shapira]

    Regarding your scenario, only one broker instance and one producer with multiple consumer, u can use pusher to create a channel, and push event to that channel that consumer can subscribe to and hand those events. https://pusher.com/

    0 讨论(0)
  • 2020-12-04 07:06

    Zookeeper is centralizing and management system for any kind of distributed systems. Distributed system is different software modules running on different nodes/clusters (might be on geographically distant locations) but running as one system. Zookeeper facilitates communication between the nodes, sharing configurations among the nodes, it keeps track of which node is leader, which node joins/leaves, etc. Zookeeper is the one who keeps distributed systems sane and maintains consistency. Zookeeper basically is an orchestration platform.

    Kafka is a distributed system. And hence it needs some kind of orchestration for its nodes that might be geographically distant (or not).

    0 讨论(0)
提交回复
热议问题