本篇文章給大家分享的是有關(guān)怎樣驗(yàn)證kafka集群高可用,小編覺(jué)得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話(huà)不多說(shuō),跟著小編一起來(lái)看看吧。
成都地區(qū)優(yōu)秀IDC服務(wù)器托管提供商(創(chuàng)新互聯(lián)建站).為客戶(hù)提供專(zhuān)業(yè)的成都服務(wù)器托管,四川各地服務(wù)器托管,成都服務(wù)器托管、多線服務(wù)器托管.托管咨詢(xún)專(zhuān)線:18982081108情形1:建一個(gè)topic:mytopic共3個(gè)分區(qū),3個(gè)ReplicationFactor
bin/kafka-topics.sh --create --zookeeper 192.168.135.130:2181,192.168.135.129:2181,192.168.135.131:2181 --replication-factor 3 --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
如果掛掉分區(qū)0對(duì)應(yīng)的1號(hào)節(jié)點(diǎn),則可以正常發(fā)送消息
情形2:建一個(gè)topic:yourtopic共3個(gè)分區(qū),1個(gè)ReplicationFactor
bin/kafka-topics.sh --create --zookeeper 192.168.135.130:2181,192.168.135.129:2181,192.168.135.131: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
如果掛掉分區(qū)0對(duì)應(yīng)的2號(hào)節(jié)點(diǎn),則不能正常發(fā)送消息,報(bào)錯(cuò):Error: partition 0 does not have a leader. Skip getting offsets
以上就是怎樣驗(yàn)證kafka集群高可用,小編相信有部分知識(shí)點(diǎn)可能是我們?nèi)粘9ぷ鲿?huì)見(jiàn)到或用到的。希望你能通過(guò)這篇文章學(xué)到更多知識(shí)。更多詳情敬請(qǐng)關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司行業(yè)資訊頻道。