kafka 主题分区的最大复制因子是多少 [英] What is the maximum replication factor for a partition of kafka topic

查看:83
本文介绍了kafka 主题分区的最大复制因子是多少的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 kafka 集群有 3 个代理和几个主题,每个主题有 5 个分区.现在我想为分区设置复制因子.

I hava kafka cluster having 3 brokers and a couple of topics with each having 5 partitions. Now i want to set the replication factor for the partitions.

我可以为 kafka 主题的分区设置的最大复制因子是多少?

What is the maximum replication factor which i can set for a partition of kafka topic?

推荐答案

复制因子决定了每个分区的复制数量,这允许 Kafka 自动故障转移到这些副本当集群中的服务器出现故障时,消息仍然可用万一失败

Replication factor determines the number of replications each partition have, this allows Kafka to automatically failover to these replicas when a server in the cluster fails so that messages remain available in case of failures

分区副本分布在代理之间,一个代理应该保留一个副本,这意味着我们不能拥有超过代理数量的副本

Partition replicas are distributed across brokers and one broker should keep one replica that means we can't have more replicas than the number of brokers

最大复制因子 <= 经纪人数量.

这也是为了确定min.insync.replicas,这意味着它总是小于或等于replication-factor

This is also meant to determine min.insync.replicas, that means it will always be less than or equal to replication-factor

min.insync.replicas 表示 <= 复制因子

min.insync.replicas 是您愿意随时在线以继续运行的最小数据副本数并接受新的传入消息.

min.insync.replicas is the minimum number of copies of the data that you are willing to be online at any time to continue running and accepting new incoming messages.

理想情况下复制因子 3 如上所述是好的,但是,根据用例,您可以调整复制因子小于 2(意味着高风险),同时大于 3 提供更好的可用性但需要更多的开销和更大的尺寸.

Ideally replication factor 3 is good as mentioned above, however, based on the use case you can tune replication factor less than 2 (means high risk) and the same time more than 3 provide better availability but more overhead and more size required.

在决定复制因子时,还要考虑以下几点:

A):Broker Size 复制因子直接影响整个 Broker 磁盘大小

A): Broker Size Replication factor directly impacts the overall broker disk size

所以高复制因子需要更大的磁盘空间

So a high replication factor requires more disk size

B)大量的分区复制:如果大量的分区复制会增加额外的延迟.

B)Large Number of Partition replication: In case of a large number of partitions replication extra latency is added.

这篇关于kafka 主题分区的最大复制因子是多少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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