直接停掉192.168.233.133:9092 (broker.id = 5)
查看topic 分区
$ /data/kafka_2.13-3.0.0/bin/kafka-topics.sh --bootstrap-server 192.168.233.132:9092 --topic quickstart77-events --describe
Topic: quickstart77-events TopicId: A7bNWYseSNqlGfs1XPhN9g PartitionCount: 6 ReplicationFactor: 2 Configs: segment.bytes=1073741824
Topic: quickstart77-events Partition: 0 Leader: 4 Replicas: 5,4 Isr: 4
Topic: quickstart77-events Partition: 1 Leader: 1 Replicas: 1,2 Isr: 1,2
Topic: quickstart77-events Partition: 2 Leader: 4 Replicas: 4,3 Isr: 4,3
Topic: quickstart77-events Partition: 3 Leader: 2 Replicas: 2,0 Isr: 2,0
Topic: quickstart77-events Partition: 4 Leader: 3 Replicas: 3,5 Isr: 3
Topic: quickstart77-events Partition: 5 Leader: 0 Replicas: 0,1 Isr: 0,1
宕掉的broker已经不在leader和Isr中,Replicas依然还在
恢复192.168.233.133:9092 (broker.id = 5)
$ /data/kafka_2.13-3.0.0/bin/kafka-topics.sh --bootstrap-server 192.168.233.132:9092 --topic quickstart77-events --describe
Topic: quickstart77-events TopicId: A7bNWYseSNqlGfs1XPhN9g PartitionCount: 6 ReplicationFactor: 2 Configs: segment.bytes=1073741824
Topic: quickstart77-events Partition: 0 Leader: 4 Replicas: 5,4 Isr: 4,5
Topic: quickstart77-events Partition: 1 Leader: 1 Replicas: 1,2 Isr: 1,2
Topic: quickstart77-events Partition: 2 Leader: 4 Replicas: 4,3 Isr: 4,3
Topic: quickstart77-events Partition: 3 Leader: 2 Replicas: 2,0 Isr: 2,0
Topic: quickstart77-events Partition: 4 Leader: 3 Replicas: 3,5 Isr: 3,5
Topic: quickstart77-events Partition: 5 Leader: 0 Replicas: 0,1 Isr: 0,1
Isr中已经恢复看到了,但是leader中还是没有
再过一段时间再观察文章来源:https://www.toymoban.com/news/detail-627441.html
$ /data/kafka_2.13-3.0.0/bin/kafka-topics.sh --bootstrap-server 192.168.233.132:9092 --topic quickstart77-events --describe
Topic: quickstart77-events TopicId: A7bNWYseSNqlGfs1XPhN9g PartitionCount: 6 ReplicationFactor: 2 Configs: segment.bytes=1073741824
Topic: quickstart77-events Partition: 0 Leader: 5 Replicas: 5,4 Isr: 4,5
Topic: quickstart77-events Partition: 1 Leader: 1 Replicas: 1,2 Isr: 1,2
Topic: quickstart77-events Partition: 2 Leader: 4 Replicas: 4,3 Isr: 4,3
Topic: quickstart77-events Partition: 3 Leader: 2 Replicas: 2,0 Isr: 2,0
Topic: quickstart77-events Partition: 4 Leader: 3 Replicas: 3,5 Isr: 3,5
Topic: quickstart77-events Partition: 5 Leader: 0 Replicas: 0,1 Isr: 0,1
leader也能自动恢复了文章来源地址https://www.toymoban.com/news/detail-627441.html
到了这里,关于模拟宕机后kafka的重新分区的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!