直接停掉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中还是没有
再过一段时间再观察
$ /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也能自动恢复了