How to verify the high availability of kafka clusters
What this article shares with you is about how to verify the high availability of kafka clusters. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
Scenario 1: build a topic:mytopic with 3 partitions and 3 ReplicationFactor
Bin/kafka-topics.sh-- create-- zookeeper 192.168.135.130 partitions 2181192.168.135.129 zookeeper 2181192.168.135.131 partitions 2181-- partitions 3-- topic mytopic
Topic:mytopic PartitionCount:3 ReplicationFactor:3 Configs:
Topic: mytopic Partition: 0 Leader: 1 Replicas: 1,2,0 Isr: 1,2,0
Topic: mytopic Partition: 1 Leader: 2 Replicas: 2,0,1 Isr: 2,0,1
Topic: mytopic Partition: 2 Leader: 0 Replicas: 0,1,2 Isr: 0,1,2
If you hang up the No.1 node corresponding to partition 0, you can send messages normally.
Scenario 2: build a topic:yourtopic with 3 partitions and 1 ReplicationFactor
Bin/kafka-topics.sh-- create-- zookeeper 192.168.135.130 partitions 2181192.168.135.129 zookeeper 2181192.168.135.131Rose 2181-- replication-factor 1-- partitions 3-- topic yourtopic
Topic:yourtopic PartitionCount:3 ReplicationFactor:1 Configs:
Topic: yourtopic Partition: 0 Leader: 2 Replicas: 2 Isr: 2
Topic: yourtopic Partition: 1 Leader: 0 Replicas: 0 Isr: 0
Topic: yourtopic Partition: 2 Leader: 1 Replicas: 1 Isr: 1
If you hang up the No.2 node corresponding to partition 0, you will not be able to send a message normally. Error: Error: partition 0 does not have a leader. Skip getting offsets
The above is how to verify the high availability of kafka clusters. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.