Bootstrap server vs zookeeper in kafka?

妖精的绣舞 提交于 2020-01-12 02:42:23

问题


Why the use of zookeeper in kafka-consumer is deprecated and why it's recommended to use the bootstrap server instead ? what are the advantages of the bootstrap-server?


回答1:


Kafka consumer need to commit the offset to kafka and fetch the offset from kafka , since kafka moved the offset storage from zookeeper to kafka brokers, kafka-consumer does not need to directly communicate with zookeeper, so the new kafka consumer does not need to config the zookeeper. But kafka consumer always need to connect to kafka brokers (cluster) to send the request to server, the bootstrap-server is just some brokers of this cluster, and using this, consumer could find all the brokers.




回答2:


  • In older version of Kafka (v 0.9.0) Kafka use to store data on Kafka server and all offset related information like (current partition offsets) were stored in zookeeper. So for a consumer to run it requires both data and meta data.So for getting meta data, it has to call zookeeper. That's why it is using both zookeeper and Kafka. ex Old Consumer Code
  • In new versions of Kafka i.e ( v 0.10.0 - above). It stores all topic metadata information(total partitions and their current offsets) in the __consumer_offset topic on the same Kafka server. So now only Kafka broker only need to communicate with zookeeper and consumer gets all data and metadata from kafkabroker itself so it now no longer need to communicate with zookeeper.

Advantage of the current architecture : 1. Data and metadata at the same place much easy to manage.




回答3:


In the current kafka-consumer tool using the --zookeeper or --bootstrap-server arguments distinguish between using the old and the new consumer. The old consumer needs Zookeeper connection because offset are saved there. The new consumer doesn't need Zookeeper anymore because offsets are saved to __consumer_offset topics on Kafka brokers. Using the old consumer is discouraged today so for new applications it's better using the new implementation.



来源:https://stackoverflow.com/questions/46173003/bootstrap-server-vs-zookeeper-in-kafka

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!