本文介绍了Kafka 0.10快速入门:使用者在使用“主要"功能时失败经纪人被打倒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,根据主要文档,我正在尝试使用kafka quickstart .按照说明进行了多集群示例的所有设置和测试,它可以工作.例如,放下一位经纪人,生产者和消费者仍然可以发送和接收.

So I'm trying the kafka quickstart as per the main documentation. Got the multi-cluster example all setup and test per the instructions and it works. For example, bringing down one broker and the producer and consumer can still send and receive.

但是,根据示例,我们设置了3个代理,然后关闭了代理2(代理ID = 1).现在,如果我再次调高所有经纪人,但调低经纪人1(经纪人ID = 0),则消费者就挂了.这仅在代理1(id = 0)上发生,在代理2或3上没有发生.我正在Windows 7上对此进行测试.

However, as per the example, we setup 3 brokers and we bring down broker 2 (with broker id = 1). Now if I bring up all brokers again, but I bring down broker 1 (with broker id = 0), the consumer just hangs. This only happens with broker 1 (id = 0), does not happen with broker 2 or 3. I'm testing this on Windows 7.

经纪人1在这里有什么特别的地方吗?查看配置,除了id,端口号和日志文件位置之外,所有三个代理之间的配置完全相同.

Is there something special here with broker 1? Looking at the config they are exactly the same between all 3 brokers except the id, port number and log file location.

我认为这只是提供的控制台使用者的一个问题,它不会列出代理列表,因此我使用默认设置按照其文档编写了一个简单的Java使用者,但其文档却在引导程序"中指定.服务器"属性,但没有骰子,仍然会遇到相同的问题.

I thought it is just a problem with the provided console consumer which doesn't take a broker list, so I wrote a simple java consumer as per their documentation using the default setup but specify the list of brokers in the "bootstrap.servers" property, but no dice, still get the same problem.

启动经纪人1(经纪人ID = 0)后,消费者将恢复工作.对于使用者来说,这不是一个高度可用/容错的行为...在如何设置HA/容错使用者方面有任何帮助吗?

The moment I startup broker 1 (broker id = 0), the consumers will just resume working. This isn't a highly available/fault tolerant behavior for the consumer... any help on how to setup a HA/fault tolerant consumer?

生产者似乎没有问题.

推荐答案

如果您遵循快速入门,则默认情况下,创建的主题应该只有一个分区和一个副本,该副本默认托管在第一个代理(即代理1)中.这就是为什么当您关闭该经纪人时消费者失败了的原因.

If you follow the quick-start, the created topic should have only one partition with one replica which is hosted in the first broker by default, namely broker 1. That's why the consumer got failed when you brought down this broker.

尝试创建具有多个副本的主题(在创建主题时指定--replication-factor),然后重新运行测试以查看它是否带来更高的可用性.

Try to create a topic with multiple replicas(specifying --replication-factor when creating topic) and rerun your test to see whether it brings higher availability.

这篇关于Kafka 0.10快速入门:使用者在使用“主要"功能时失败经纪人被打倒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 05:44