当 Kafka 副本之一宕机时会发生什么 [英] What happens when one of the Kafka replicas is down
问题描述
我有一个由 2 个 Kafka 代理组成的集群和一个复制因子为 2 的主题.如果其中一个代理死亡,我的生产者能否继续向这个降级的 1 个节点集群发送新消息?或者复制因子 2 需要 2 个活动节点并且 messaged 会被拒绝?
I have a cluster of 2 Kafka brokers and a topic with replication factor 2. If one of the brokers dies, will my producers be able to continue sending new messages to this degraded cluster of 1 node? Or replication factor 2 requires 2 alive nodes and messaged will be refused?
推荐答案
如果没有,消息将不会被忽略.活动代理的数量少于配置的副本.每当一个新的 Kafka 代理加入集群时,数据就会被复制到该节点.
Messages will not be ignored if the no. of alive brokers is lesser than the configured replicas. Whenever a new Kafka broker joins the cluster, the data gets replicated to that node.
您可以通过将复制因子配置为 3 或更多并仅启动一个代理来重现此场景.
You can reproduce this scenario by configuring the replication factor as 3 or more and start only one broker.
这篇关于当 Kafka 副本之一宕机时会发生什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!