Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache kafka 卡夫卡+;Apache Kafka配置避免同步问题的最佳实践_Apache Kafka - Fatal编程技术网

Apache kafka 卡夫卡+;Apache Kafka配置避免同步问题的最佳实践

Apache kafka 卡夫卡+;Apache Kafka配置避免同步问题的最佳实践,apache-kafka,Apache Kafka,我们有3台版本为-0.1的卡夫卡机器 我们看到一些主题被称为-bio_test_covid9_verification 不平衡,ISR不同步,如下所示 Topic: bio_test_covid9_verifcation Partition: 0 Leader: 1003 Replicas: 1003,1001,1002 Isr: 1003 Topic: bio_test_covid9_verifcation Partition: 1 Lea

我们有3台版本为-0.1的卡夫卡机器

我们看到一些主题被称为-bio_test_covid9_verification 不平衡,ISR不同步,如下所示

 Topic: bio_test_covid9_verifcation  Partition: 0    Leader: 1003    Replicas: 1003,1001,1002        Isr: 1003
        Topic: bio_test_covid9_verifcation  Partition: 1    Leader: 1003    Replicas: 1001,1002,1003        Isr: 1003
        Topic: bio_test_covid9_verifcation  Partition: 2    Leader: 1002    Replicas: 1002,1003,1001        Isr: 1003,1002,1001
        Topic: bio_test_covid9_verifcation  Partition: 3    Leader: 1003    Replicas: 1003,1002,1001        Isr: 1003
        Topic: bio_test_covid9_verifcation  Partition: 4    Leader: 1003    Replicas: 1001,1003,1002        Isr: 1003
        Topic: bio_test_covid9_verifcation  Partition: 5    Leader: 1002    Replicas: 1002,1001,1003        Isr: 1003,1002,1001
        Topic: bio_test_covid9_verifcation  Partition: 6    Leader: 1003    Replicas: 1003,1001,1002        Isr: 1003
        Topic: bio_test_covid9_verifcation  Partition: 7    Leader: 1003    Replicas: 1001,1002,1003        Isr: 1003
        Topic: bio_test_covid9_verifcation  Partition: 8    Leader: 1002    Replicas: 1002,1003,1001        Isr: 1003,1002,1001
        Topic: bio_test_covid9_verifcation  Partition: 9    Leader: 1003    Replicas: 1003,1002,1001        Isr: 1003
        Topic: bio_test_covid9_verifcation  Partition: 10   Leader: 1003    Replicas: 1001,1003,1002        Isr: 1003
        Topic: bio_test_covid9_verifcation  Partition: 11   Leader: 1002    Replicas: 1002,1001,1003        Isr: 1003,1002,1001
        
人们所期望的应该是这样的

 Topic: bio_test_covid9_verifcation  Partition: 0    Leader: 1003    Replicas: 1003,1001,1002        Isr: 1003
        Topic: bio_test_covid9_verifcation  Partition: 1    Leader: 1001    Replicas: 1001,1002,1003        Isr: 1003,1002,1001
        Topic: bio_test_covid9_verifcation  Partition: 2    Leader: 1002    Replicas: 1002,1003,1001        Isr: 1003,1002,1001
        Topic: bio_test_covid9_verifcation  Partition: 3    Leader: 1003    Replicas: 1003,1002,1001        Isr: 1003,1002,1001
        Topic: bio_test_covid9_verifcation  Partition: 4    Leader: 1001    Replicas: 1001,1003,1002        Isr: 1003,1002,1001
        Topic: bio_test_covid9_verifcation  Partition: 5    Leader: 1002    Replicas: 1002,1001,1003        Isr: 1003,1002,1001
        Topic: bio_test_covid9_verifcation  Partition: 6    Leader: 1003    Replicas: 1003,1001,1002        Isr: 1003,1002,1001
        Topic: bio_test_covid9_verifcation  Partition: 7    Leader: 1001    Replicas: 1001,1002,1003        Isr: 1003,1002,1001
        Topic: bio_test_covid9_verifcation  Partition: 8    Leader: 1002    Replicas: 1002,1003,1001        Isr: 1003,1002,1001
        Topic: bio_test_covid9_verifcation  Partition: 9    Leader: 1003    Replicas: 1003,1002,1001        Isr: 1003,1002,1001
        Topic: bio_test_covid9_verifcation  Partition: 10   Leader: 1001    Replicas: 1001,1003,1002        Isr: 1003,1002,1001
        Topic: bio_test_covid9_verifcation  Partition: 11   Leader: 1002    Replicas: 1002,1001,1003        Isr: 1003,1002,1001
        
    
因此,总共只有63个主题中的2个主题处于错误状态,即ISR不同步,领导者不平衡

所以为了调查这里发生了什么,我们首先验证一些卡夫卡参数,以便了解同步问题是否与不正确的卡夫卡参数有关 这里我给出了一些配置的参数

例如,在我们的卡夫卡配置中

    `min.insync.replicas=1`  ( while replication.factor is 3 )
    
据我所知,
min.insync.replications
是代理上的一种配置,表示代理允许存在的最小同步副本数 acks=全部

所以我想问一下
min.insync.replicas=1的设置是否是问题的一部分?如果我们设置
min.insync.replicas=3
,则可以避免同步ISR问题

您认为呢?

副本关闭之类的“同步问题”并不是代理配置不正确的症状,而是表明您有其他网络或硬件故障导致代理变得不健康

您肯定应该维护
min.insync.replicas=2
,以确保丢失一个代理不会丢失数据。将复制因子设置为3和相等并不是最佳做法


这是这样说的。

我们的卡夫卡中的默认值是min.insync.replicas=1,您认为我们应该将其设置为min.insync.replicas=2吗?我的答案没有说任何不同。在我看到的文档中,禁用不干净的领导人选举,这是ambari中定义的参数。我从未将ambari与卡夫卡一起使用过,但是您应该能够定义自己的
server.properties