在所有情况下,如果任何一个 Kafka 代理启动并运行,我的生产者和消费者都应该正常运行。
里面的参数server.properties如下,用于集群的高可用。
transaction.state.log.min.isr=2
offsets.topic.replication.factor=3
transaction.state.log.replication.factor=3
Run Code Online (Sandbox Code Playgroud)
如果我遗漏了什么,请告诉我,如果我设置了怎么办transaction.state.log.min.isr=3?
提前致谢。
小智 8
所做transaction.state.log.min.isr的就是覆盖min.insync.replicas事务主题的配置 - __transaction_state。
基本上它控制该主题的最小 ISR。在你提到的场景中——
如果 K1 和 K2 代理出现故障并且只有 K3 正常运行,则集群运行良好。
该集群不会很好,您将无法对该集群进行生产。生产者将提出NotEnoughReplicas例外。发生这种情况是因为您不符合所做的配置。
例如,您在名为 的主题上使用的复制因子为 3 mycooltopic,而您的代理设置min.insync.replicas为 2。
当生成 to mycooltopic(with acks=all/-1) 时,您将需要至少有 2 个副本,这些副本必须在写入被视为成功写入之前确认该写入。
因此,如果想要将其更改min.insync.replicas为 3 - 您将需要向集群添加更多代理。
您可以在 Confluence 博客 - Hands-free Kafka Replication中阅读有关 Kafka 复制的更多信息,并查看官方文档(跳转至min.insync.replicas)。
transaction.state.log.min.isr is just dedicated min.insync.replicas but for the __transaction_state topic (internal topic created when you start using transactions). So it's just overriding the min.insync.replicas.
Maybe you already know, but setting the min.insync.replicas to 2 means that when your producer ( with acks=all) will produce a record for a specific topic, the corresponding broker will wait that two ISR acknowledge the write ( here the leader and one replica).
Exact same behavior with transaction.state.log.min.isr, but this will only apply to the __transaction_state internal topic
So it does make sense to set it to 2 when you have a replication factor of 3.
But, not sure to understand what you meant :
If all 3 Kafka brokers(K1, K2 and K3) are up cluster runs fine. ==> indeed
If K1 and K2 brokers goes down and only K3 is up then cluster runs fine.
==> 由于不满足复制因子,您将无法生成(acks=all 或 >1)新记录。
此外,您将无法在生产/消费时创建新主题(将获得 INVALID_REPLICATION_FACTOR)
你的集群肯定不行
| 归档时间: |
|
| 查看次数: |
9187 次 |
| 最近记录: |