Kafka 0.8中producer能不能找到broker的增删改查? [英] Can producer find the additions and removals of brokers in Kafka 0.8?

查看:20
本文介绍了Kafka 0.8中producer能不能找到broker的增删改查?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们知道,在kafka 0.7中,我们可以为producer指定zk.connect,这样producer可以找到broker的增删.但是在 kafka 0.8 中,我们不能为生产者指定 zk.connect.kafka 0.8 中的生产者能找到吗?如果不是,系统的扩展性不比0.7版本差?

We knowthat, in kafka 0.7, we can specify zk.connect for producer, so producer can find the additions and removals of broker. But in kafka 0.8, we can't specify zk.connect for producer. Can producer in kafka 0.8 find that? If not, the scalability of the system is not worse than the 0.7 version?

推荐答案

您仍然可以使用 ZooKeeper 客户端来检索代理列表:

You can still use a ZooKeeper client to retrieve the broker list:

ZkClient zkClient = new ZkClient("localhost:2108", 4000, 6000, new BytesPushThroughSerializer());
List<String> brokerList = zkClient.getChildren("/brokers/ips");

因此,您不必在客户端对代理列表进行硬编码",并且就系统架构而言,您是灵活的.但无论如何,这会再次添加 ZooKeeper 依赖项,这实际上在一些环境中对生产者来说是不利的.

According to that, you do not have to "hardcode" the broker list on client side and you are flexible as far as the system architecture is concerned. But anyway, this would add the ZooKeeper dependency again which is in fact an disadvantage for producer in several environments.

如果您想详细了解所谓的集群元数据 API"解决方案,请查看此链接:https://issues.apache.org/jira/browse/KAFKA-369

If you want to get a detailed view to the so called "cluster metadata API" solution, check out this link: https://issues.apache.org/jira/browse/KAFKA-369

最佳

P.S.:很抱歉将其转发到您的另一个问题 - 但答案适用于两者;-)

P.S.: Sorry for reposting this to your other question - but the answer fits on both ;-)

这篇关于Kafka 0.8中producer能不能找到broker的增删改查?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆