卡夫卡+分区副本如何大于配置的 ReplicationFactor
我们在 Linux 机器上有 Kafka 集群,有 11 个代理,
我们有主题 - my_first_car ,有 300 个分区,并且这个主题配置了复制因子 = 3
我们从
kafka-topics.sh --zookeeper zoo01:2181 --describe
以下示例中注意到: (请查看 --> ReplicationFactor:3 )
Topic:my_first_car PartitionCount:300 ReplicationFactor:3 Configs:retention.ms=17280000,retention.bytes=27571641765
Topic: my_first_car Partition: 0 Leader: 1009 Replicas: 1009,1007,1008 Isr: 1007,1008,1009
Topic: my_first_car Partition: 1 Leader: 1001 Replicas: 1001,1011,1008,1010,1009 Isr: 1001,1011,1008,1010,1009
Topic: my_first_car Partition: 2 Leader: 1001 Replicas: 1001,1002,1011,1010,1009 Isr: 1001,1002,1011,1010,1009
Topic: my_first_car Partition: 3 Leader: 1001 Replicas: 1001,1002,1011,1003,1010 Isr: 1001,1002,1011,1003,1010
Topic: my_first_car Partition: 4 Leader: 1002 Replicas: 1002,1011,1001 Isr: 1002,1001,1011
Topic: my_first_car Partition: 5 Leader: 1005 Replicas: 1005,1001,1002,1003,1004 Isr: 1003,1005,1001,1002
Topic: my_first_car Partition: 6 Leader: 1005 Replicas: 1005,1006,1002,1003,1004 Isr: 1005,1003,1002,1006
Topic: my_first_car Partition: 7 Leader: 1005 Replicas: 1005,1003,1004 Isr: 1003,1005,1004
Topic: my_first_car Partition: 8 Leader: 1005 Replicas: 1006,1004,1005 Isr: 1005,1004,1006
Topic: my_first_car Partition: 9 Leader: 1005 Replicas: 1005,1006,1007,1008,1009 Isr: 1005,1006,1007,1008,1009
Topic: my_first_car Partition: 10 Leader: 1007 Replicas: 1007,1009,1010 Isr: 1009,1007,1010
Topic: my_first_car Partition: 11 Leader: 1008 Replicas: 1008,1011,1001 Isr: 1001,1008,1011
Topic: my_first_car Partition: 12 Leader: 1009 Replicas: 1009,1001,1002 Isr: 1002,1001,1009
Topic: my_first_car Partition: 13 Leader: 1010 Replicas: 1010,1002,1003 Isr: 1003,1002,1010
Topic: my_first_car Partition: 14 Leader: 1011 Replicas: 1011,1003,1004 Isr: 1003,1004,1011
Topic: my_first_car Partition: 15 Leader: 1001 Replicas: 1001,1004,1005 Isr: 1005,1001
Topic: my_first_car Partition: 16 Leader: 1002 Replicas: 1002,1005,1006 Isr: 1005,1002,1006
Topic: my_first_car Partition: 17 Leader: 1003 Replicas: 1003,1006,1007 Isr: 1003,1006,1007
Topic: my_first_car Partition: 18 Leader: 1004 Replicas: 1004,1007,1008 Isr: 1004,1007,1008
正如我们在上面看到的,在某些分区上我们有 5 个副本,在 2 个分区上我们有有 4 个副本
,但配置清楚地表明 - ReplicationFactor:3
我们还检查了机器上的副本,我们看到分区确实根据描述的输出进行了复制
,那么修复此行为的方法是什么,以便只有 3
副本和 3
Isr ?
预期结果示例
Topic:my_first_car PartitionCount:300 ReplicationFactor:3 Configs:retention.ms=17280000,retention.bytes=27571641765
Topic: my_first_car Partition: 0 Leader: 1009 Replicas: 1009,1007,1008 Isr: 1007,1008,1009
Topic: my_first_car Partition: 1 Leader: 1001 Replicas: 1001,1011,1008 Isr: 1001,1011,1008
Topic: my_first_car Partition: 2 Leader: 1001 Replicas: 1001,1002,1011 Isr: 1001,1002,1011
Topic: my_first_car Partition: 3 Leader: 1001 Replicas: 1001,1002,1011 Isr: 1001,1002,1011
Topic: my_first_car Partition: 4 Leader: 1002 Replicas: 1002,1011,1001 Isr: 1002,1001,1011
Topic: my_first_car Partition: 5 Leader: 1005 Replicas: 1005,1001,1002 Isr: 1003,1005,1001
Topic: my_first_car Partition: 6 Leader: 1005 Replicas: 1005,1006,1002 Isr: 1005,1003,1002
Topic: my_first_car Partition: 7 Leader: 1005 Replicas: 1005,1003,1004 Isr: 1003,1005,1004
Topic: my_first_car Partition: 8 Leader: 1005 Replicas: 1006,1004,1005 Isr: 1005,1004,1006
Topic: my_first_car Partition: 9 Leader: 1005 Replicas: 1005,1006,1007 Isr: 1005,1006,1007
Topic: my_first_car Partition: 10 Leader: 1007 Replicas: 1007,1009,1010 Isr: 1009,1007,1010
Topic: my_first_car Partition: 11 Leader: 1008 Replicas: 1008,1011,1001 Isr: 1001,1008,1011
Topic: my_first_car Partition: 12 Leader: 1009 Replicas: 1009,1001,1002 Isr: 1002,1001,1009
Topic: my_first_car Partition: 13 Leader: 1010 Replicas: 1010,1002,1003 Isr: 1003,1002,1010
Topic: my_first_car Partition: 14 Leader: 1011 Replicas: 1011,1003,1004 Isr: 1003,1004,1011
Topic: my_first_car Partition: 15 Leader: 1001 Replicas: 1001,1004,1005 Isr: 1005,1001,1007
Topic: my_first_car Partition: 16 Leader: 1002 Replicas: 1002,1005,1006 Isr: 1005,1002,1006
Topic: my_first_car Partition: 17 Leader: 1003 Replicas: 1003,1006,1007 Isr: 1003,1006,1007
Topic: my_first_car Partition: 18 Leader: 1004 Replicas: 1004,1007,1008 Isr: 1004,1007,1008
问题 - 访问 Kafka 机器并从磁盘中删除额外副本是否是一个好的选择?
类似帖子 - 无法重新分配 kafka 主题分区
we have Kafka cluster with 11 brokers on Linux machines
we have topic - my_first_car , with 300
partitions , and this topic configured with replication factor = 3
we notice from
kafka-topics.sh --zookeeper zoo01:2181 --describe
the following example: ( please look on --> ReplicationFactor:3 )
Topic:my_first_car PartitionCount:300 ReplicationFactor:3 Configs:retention.ms=17280000,retention.bytes=27571641765
Topic: my_first_car Partition: 0 Leader: 1009 Replicas: 1009,1007,1008 Isr: 1007,1008,1009
Topic: my_first_car Partition: 1 Leader: 1001 Replicas: 1001,1011,1008,1010,1009 Isr: 1001,1011,1008,1010,1009
Topic: my_first_car Partition: 2 Leader: 1001 Replicas: 1001,1002,1011,1010,1009 Isr: 1001,1002,1011,1010,1009
Topic: my_first_car Partition: 3 Leader: 1001 Replicas: 1001,1002,1011,1003,1010 Isr: 1001,1002,1011,1003,1010
Topic: my_first_car Partition: 4 Leader: 1002 Replicas: 1002,1011,1001 Isr: 1002,1001,1011
Topic: my_first_car Partition: 5 Leader: 1005 Replicas: 1005,1001,1002,1003,1004 Isr: 1003,1005,1001,1002
Topic: my_first_car Partition: 6 Leader: 1005 Replicas: 1005,1006,1002,1003,1004 Isr: 1005,1003,1002,1006
Topic: my_first_car Partition: 7 Leader: 1005 Replicas: 1005,1003,1004 Isr: 1003,1005,1004
Topic: my_first_car Partition: 8 Leader: 1005 Replicas: 1006,1004,1005 Isr: 1005,1004,1006
Topic: my_first_car Partition: 9 Leader: 1005 Replicas: 1005,1006,1007,1008,1009 Isr: 1005,1006,1007,1008,1009
Topic: my_first_car Partition: 10 Leader: 1007 Replicas: 1007,1009,1010 Isr: 1009,1007,1010
Topic: my_first_car Partition: 11 Leader: 1008 Replicas: 1008,1011,1001 Isr: 1001,1008,1011
Topic: my_first_car Partition: 12 Leader: 1009 Replicas: 1009,1001,1002 Isr: 1002,1001,1009
Topic: my_first_car Partition: 13 Leader: 1010 Replicas: 1010,1002,1003 Isr: 1003,1002,1010
Topic: my_first_car Partition: 14 Leader: 1011 Replicas: 1011,1003,1004 Isr: 1003,1004,1011
Topic: my_first_car Partition: 15 Leader: 1001 Replicas: 1001,1004,1005 Isr: 1005,1001
Topic: my_first_car Partition: 16 Leader: 1002 Replicas: 1002,1005,1006 Isr: 1005,1002,1006
Topic: my_first_car Partition: 17 Leader: 1003 Replicas: 1003,1006,1007 Isr: 1003,1006,1007
Topic: my_first_car Partition: 18 Leader: 1004 Replicas: 1004,1007,1008 Isr: 1004,1007,1008
as we can see above on some partitions we have 5 replicas and on 2 partitions we have 4 replicas
but the configuration say clearly that - ReplicationFactor:3
we also check physically the replica on machines , and we saw that partition are really replicated according to described output
so what is the way to fix this bhavior , in order to have only 3
replica and 3
Isr ?
example of expected results
Topic:my_first_car PartitionCount:300 ReplicationFactor:3 Configs:retention.ms=17280000,retention.bytes=27571641765
Topic: my_first_car Partition: 0 Leader: 1009 Replicas: 1009,1007,1008 Isr: 1007,1008,1009
Topic: my_first_car Partition: 1 Leader: 1001 Replicas: 1001,1011,1008 Isr: 1001,1011,1008
Topic: my_first_car Partition: 2 Leader: 1001 Replicas: 1001,1002,1011 Isr: 1001,1002,1011
Topic: my_first_car Partition: 3 Leader: 1001 Replicas: 1001,1002,1011 Isr: 1001,1002,1011
Topic: my_first_car Partition: 4 Leader: 1002 Replicas: 1002,1011,1001 Isr: 1002,1001,1011
Topic: my_first_car Partition: 5 Leader: 1005 Replicas: 1005,1001,1002 Isr: 1003,1005,1001
Topic: my_first_car Partition: 6 Leader: 1005 Replicas: 1005,1006,1002 Isr: 1005,1003,1002
Topic: my_first_car Partition: 7 Leader: 1005 Replicas: 1005,1003,1004 Isr: 1003,1005,1004
Topic: my_first_car Partition: 8 Leader: 1005 Replicas: 1006,1004,1005 Isr: 1005,1004,1006
Topic: my_first_car Partition: 9 Leader: 1005 Replicas: 1005,1006,1007 Isr: 1005,1006,1007
Topic: my_first_car Partition: 10 Leader: 1007 Replicas: 1007,1009,1010 Isr: 1009,1007,1010
Topic: my_first_car Partition: 11 Leader: 1008 Replicas: 1008,1011,1001 Isr: 1001,1008,1011
Topic: my_first_car Partition: 12 Leader: 1009 Replicas: 1009,1001,1002 Isr: 1002,1001,1009
Topic: my_first_car Partition: 13 Leader: 1010 Replicas: 1010,1002,1003 Isr: 1003,1002,1010
Topic: my_first_car Partition: 14 Leader: 1011 Replicas: 1011,1003,1004 Isr: 1003,1004,1011
Topic: my_first_car Partition: 15 Leader: 1001 Replicas: 1001,1004,1005 Isr: 1005,1001,1007
Topic: my_first_car Partition: 16 Leader: 1002 Replicas: 1002,1005,1006 Isr: 1005,1002,1006
Topic: my_first_car Partition: 17 Leader: 1003 Replicas: 1003,1006,1007 Isr: 1003,1006,1007
Topic: my_first_car Partition: 18 Leader: 1004 Replicas: 1004,1007,1008 Isr: 1004,1007,1008
Question - is it good option to access the Kafka machines and to remove the additional replica from disk ?
similar posts - Cannot reassign kafka topic partition
Fixing under replicated partitions in kafka
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论