生产者可以在Kafka 0.8中找到经纪人的添加和删除吗? [英] Can producer find the additions and removals of brokers in Kafka 0.8?

查看:39
本文介绍了生产者可以在Kafka 0.8中找到经纪人的添加和删除吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们知道,在kafka 0.7中,我们可以为生产者指定zk.connect,因此生产者可以找到代理的添加和删除.但是在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

最佳

pre

P.S .:很抱歉将这个问题重新发布到您的其他问题-但答案都适合;-)

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

这篇关于生产者可以在Kafka 0.8中找到经纪人的添加和删除吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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