<em>Mac</em>Book项目 2009年学校开始实施<em>Mac</em>Book项目,所有师生配备一本<em>Mac</em>Book,并同步更新了校园无线网络。学校每周进行电脑技术更新,每月发送技术支持资料,极大改变了教学及学习方式。因此2011
2021-06-01 09:32:01
叢集上新安裝並啟動了3個kafka Broker,程式碼打包上傳至叢集,執行後發現一直消費不到資料,
本地idea中debug後發現,程式一直阻塞在如下程式中,陷入了死迴圈。
/** * Block until the coordinator for this group is known and is ready to receive requests. * 等待直到我們和伺服器端的GroupCoordinator取得連線 */ public void ensureCoordinatorReady() { while (coordinatorUnknown()) {//無法獲取GroupCoordinator RequestFuture<Void> future = sendGroupCoordinatorRequest();//傳送請求 client.poll(future);//同步等待非同步呼叫的結果 if (future.failed()) { if (future.isRetriable()) client.awaitMetadataUpdate(); else throw future.exception(); } else if (coordinator != null && client.connectionFailed(coordinator)) { // we found the coordinator, but the connection has failed, so mark // it dead and backoff before retrying discovery coordinatorDead(); time.sleep(retryBackoffMs);//等待一段時間,然後重試 } } }
問題出現在第一步,意思就是說Consumer和伺服器端的GroupCoordinator無法取得連線,所以程式一直在等待狀態。
看了下__consumer_offsets 這個topic情況,50個分割區全在broker id為152的broker上
bin/kafka-topics.sh --describe --zookeeper localhost:2182 --topic __consumer_offsets
Topic:__consumer_offsets PartitionCount:50 ReplicationFactor:1 Configs:segment.bytes=104857600,cleanup.policy=compact,compression.type=producer
Topic: __consumer_offsets Partition: 0 Leader: 152 Replicas: 152 Isr:152
Topic: __consumer_offsets Partition: 1 Leader: 152 Replicas: 152 Isr:152
Topic: __consumer_offsets Partition: 2 Leader: 152 Replicas: 152 Isr:152
Topic: __consumer_offsets Partition: 3 Leader: 152
......
但是叢集上並沒有broker id為152的節點,想到該叢集kafka節點曾經新增刪除過節點,初步斷定152是之前的kafka節點,後來該節點去掉後又加入新的節點但是zookeeper中的資料並沒有更新。
所以就關閉broker,進入zookeeper使用者端,將brokers節點下的topics節點下的__consumer_offsets刪除,然後重啟broker,注意,此時zookeeper上__consumer_offsets還並沒有生成,要開啟消費者之後才會生成.
然後再觀察__consumer_offsets,分割區已經均勻分佈在三個broker上面了
bin/kafka-topics.sh --zookeeper localhost:2182 --describe --topic __consumer_offsets
Topic:__consumer_offsets PartitionCount:50 ReplicationFactor:3 Configs:segment.bytes=104857600,cleanup.policy=compact,compression.type=producer
Topic: __consumer_offsets Partition: 0 Leader: 420 Replicas: 420,421,422 Isr: 420,422,421
Topic: __consumer_offsets Partition: 1 Leader: 421 Replicas: 421,422,420 Isr: 422,420,421
Topic: __consumer_offsets Partition: 2 Leader: 422 Replicas: 422,420,421 Isr: 422,420,421
Topic: __consumer_offsets Partition: 3 Leader: 420 Replicas: 420,422,421 Isr: 420,422,421
Topic: __consumer_offsets Partition: 4 Leader: 421 Replicas: 421,420,422 Isr: 420,422,421
Topic: __consumer_offsets Partition: 5 Leader: 422 Replicas: 422,421,420 Isr: 422,420,421
Topic: __consumer_offsets Partition: 6 Leader: 420 Replicas: 420,421,422 Isr: 420,422,421
Topic: __consumer_offsets Partition: 7 Leader: 421 Replicas: 421,422,420 Isr: 422,420,421
Topic: __consumer_offsets Partition: 8 Leader: 422 Replicas: 422,420,421 Isr: 422,420,421
Topic: __consumer_offsets Partition: 9 Leader: 420 Replicas: 420,422,421 Isr: 420,422,421
Topic: __consumer_offsets Partition: 10 Leader: 421 Replicas: 421,420,422 Isr: 420,422,421
Topic: __consumer_offsets Partition: 11 Leader: 422 Replicas: 422,421,420 Isr: 422,420,421
Topic: __consumer_offsets Partition: 12 Leader: 420 Replicas: 420,421,422 Isr: 420,422,421
Topic: __consumer_offsets Partition: 13 Leader: 421 Replicas: 421,422,420 Isr: 422,420,421
Topic: __consumer_offsets Partition: 14 Leader: 422 Replicas: 422,420,421 Isr: 422,420,421
Topic: __consumer_offsets Partition: 15 Leader: 420 Replicas: 420,422,421 Isr: 420,422,421
Topic: __consumer_offsets Partition: 16 Leader: 421 Replicas: 421,420,422 Isr: 420,422,421
Topic: __consumer_offsets Partition: 17 Leader: 422 Replicas: 422,421,420 Isr: 422,420,421
Topic: __consumer_offsets Partition: 18 Leader: 420 Replicas: 420,421,422 Isr: 420,422,421
Topic: __consumer_offsets Partition: 19 Leader: 421 Replicas: 421,422,420 Isr: 422,420,421
Topic: __consumer_offsets Partition: 20 Leader: 422 Replicas: 422,420,421 Isr: 422,420,421
Topic: __consumer_offsets Partition: 21 Leader: 420 Replicas: 420,422,421 Isr: 420,422,421
Topic: __consumer_offsets Partition: 22 Leader: 421 Replicas: 421,420,422 Isr: 420,422,421
Topic: __consumer_offsets Partition: 23 Leader: 422 Replicas: 422,421,420 Isr: 422,420,421
Topic: __consumer_offsets Partition: 24 Leader: 420 Replicas: 420,421,422 Isr: 420,422,421
Topic: __consumer_offsets Partition: 25 Leader: 421 Replicas: 421,422,420 Isr: 422,420,421
Topic: __consumer_offsets Partition: 26 Leader: 422 Replicas: 422,420,421 Isr: 422,420,421
Topic: __consumer_offsets Partition: 27 Leader: 420 Replicas: 420,422,421 Isr: 420,422,421
Topic: __consumer_offsets Partition: 28 Leader: 421 Replicas: 421,420,422 Isr: 420,422,421
Topic: __consumer_offsets Partition: 29 Leader: 422 Replicas: 422,421,420 Isr: 422,420,421
Topic: __consumer_offsets Partition: 30 Leader: 420 Replicas: 420,421,422 Isr: 420,422,421
Topic: __consumer_offsets Partition: 31 Leader: 421 Replicas: 421,422,420 Isr: 422,420,421
Topic: __consumer_offsets Partition: 32 Leader: 422 Replicas: 422,420,421 Isr: 422,420,421
Topic: __consumer_offsets Partition: 33 Leader: 420 Replicas: 420,422,421 Isr: 420,422,421
Topic: __consumer_offsets Partition: 34 Leader: 421 Replicas: 421,420,422 Isr: 420,422,421
Topic: __consumer_offsets Partition: 35 Leader: 422 Replicas: 422,421,420 Isr: 422,420,421
Topic: __consumer_offsets Partition: 36 Leader: 420 Replicas: 420,421,422 Isr: 420,422,421
Topic: __consumer_offsets Partition: 37 Leader: 421 Replicas: 421,422,420 Isr: 422,420,421
Topic: __consumer_offsets Partition: 38 Leader: 422 Replicas: 422,420,421 Isr: 422,420,421
Topic: __consumer_offsets Partition: 39 Leader: 420 Replicas: 420,422,421 Isr: 420,422,421
Topic: __consumer_offsets Partition: 40 Leader: 421 Replicas: 421,420,422 Isr: 420,422,421
Topic: __consumer_offsets Partition: 41 Leader: 422 Replicas: 422,421,420 Isr: 422,420,421
Topic: __consumer_offsets Partition: 42 Leader: 420 Replicas: 420,421,422 Isr: 420,422,421
Topic: __consumer_offsets Partition: 43 Leader: 421 Replicas: 421,422,420 Isr: 422,420,421
Topic: __consumer_offsets Partition: 44 Leader: 422 Replicas: 422,420,421 Isr: 422,420,421
Topic: __consumer_offsets Partition: 45 Leader: 420 Replicas: 420,422,421 Isr: 420,422,421
Topic: __consumer_offsets Partition: 46 Leader: 421 Replicas: 421,420,422 Isr: 420,422,421
Topic: __consumer_offsets Partition: 47 Leader: 422 Replicas: 422,421,420 Isr: 422,420,421
Topic: __consumer_offsets Partition: 48 Leader: 420 Replicas: 420,421,422 Isr: 420,422,421
Topic: __consumer_offsets Partition: 49 Leader: 421 Replicas: 421,422,420 Isr: 422,420,421
這個時候重啟程式,發現已經可以正常消費了,問題解決。
參考資料:
以上為個人經驗,希望能給大家一個參考,也希望大家多多支援it145.com。
相關文章
<em>Mac</em>Book项目 2009年学校开始实施<em>Mac</em>Book项目,所有师生配备一本<em>Mac</em>Book,并同步更新了校园无线网络。学校每周进行电脑技术更新,每月发送技术支持资料,极大改变了教学及学习方式。因此2011
2021-06-01 09:32:01
综合看Anker超能充系列的性价比很高,并且与不仅和iPhone12/苹果<em>Mac</em>Book很配,而且适合多设备充电需求的日常使用或差旅场景,不管是安卓还是Switch同样也能用得上它,希望这次分享能给准备购入充电器的小伙伴们有所
2021-06-01 09:31:42
除了L4WUDU与吴亦凡已经多次共事,成为了明面上的厂牌成员,吴亦凡还曾带领20XXCLUB全队参加2020年的一场音乐节,这也是20XXCLUB首次全员合照,王嗣尧Turbo、陈彦希Regi、<em>Mac</em> Ova Seas、林渝植等人全部出场。然而让
2021-06-01 09:31:34
目前应用IPFS的机构:1 谷歌<em>浏览器</em>支持IPFS分布式协议 2 万维网 (历史档案博物馆)数据库 3 火狐<em>浏览器</em>支持 IPFS分布式协议 4 EOS 等数字货币数据存储 5 美国国会图书馆,历史资料永久保存在 IPFS 6 加
2021-06-01 09:31:24
开拓者的车机是兼容苹果和<em>安卓</em>,虽然我不怎么用,但确实兼顾了我家人的很多需求:副驾的门板还配有解锁开关,有的时候老婆开车,下车的时候偶尔会忘记解锁,我在副驾驶可以自己开门:第二排设计很好,不仅配置了一个很大的
2021-06-01 09:30:48
不仅是<em>安卓</em>手机,苹果手机的降价力度也是前所未有了,iPhone12也“跳水价”了,发布价是6799元,如今已经跌至5308元,降价幅度超过1400元,最新定价确认了。iPhone12是苹果首款5G手机,同时也是全球首款5nm芯片的智能机,它
2021-06-01 09:30:45