首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> 更多程式語言 >> 程式設計疑難解答

解決 PyLeus 提交 JAR 至本地 Storm 時的 ZooKeeper 警告與 UI 不顯示拓撲問題

     編輯:程式設計疑難解答

問題背景

使用 PyLeus 向本地 Storm 叢集提交 JAR 包時,控制台輸出大量 ZooKeeper 相關的警告日誌,且 Storm UI 介面無法顯示拓撲已成功提交。具體錯誤日誌如下:

560680 [main-SendThread(localhost:2002)] INFO org.apache.storm.zookeeper.ClientCnxn - Session establishment complete on server localhost/127.0.0.1:2002, sessionid = 0x15415616aab000e, negotiated timeout = 20000
560681 [main-EventThread] INFO org.apache.storm.curator.framework.state.ConnectionStateManager - State change: RECONNECTED
560681 [main-SendThread(localhost:2002)] INFO org.apache.storm.zookeeper.ClientCnxn - Session establishment complete on server localhost/0:0:0:0:0:0:0:1:2002, sessionid = 0x15415616aab000f, negotiated timeout = 20000
560681 [main-EventThread] INFO org.apache.storm.curator.framework.state.ConnectionStateManager - State change: RECONNECTED
703453 [SyncThread:0] WARN org.apache.storm.zookeeper.server.persistence.FileTxnLog - fsync-ing the write ahead log in SyncThread:0 took 1246ms which will adversely effect operation latency. See the ZooKeeper troubleshooting guide
719114 [SyncThread:0] WARN org.apache.storm.zookeeper.server.persistence.FileTxnLog - fsync-ing the write ahead log in SyncThread:0 took 1506ms which will adversely effect operation latency. See the ZooKeeper troubleshooting guide

其中關鍵警告為 fsync-ing the write ahead log ... took XXXms,表示 ZooKeeper 事務日誌寫入磁碟耗時過長,嚴重影響操作延遲。

根本原因分析

此問題通常由以下原因導致:

  • 磁碟 I/O 性能不足:本地開發環境或虛擬機磁碟寫入速度較慢,導致 ZooKeeper 同步事務日誌超時。
  • 網絡回環介面配置問題:日誌中出現 IPv6 回環地址 0:0:0:0:0:0:0:1,可能導致連接不穩定。
  • PyLeus 預設提交目標為本地 Nimbus:未顯式指定 Nimbus 主機,導致提交流程異常。

解決方案

方法一:顯式指定 Nimbus 主機提交(推薦)

在提交命令中使用 -n 參數明確指定 Nimbus 主機地址,避免本地解析問題:

pyleus submit -n [nimbus_host] topology_name.jar

例如:pyleus submit -n localhost my_topology.jar 或 pyleus submit -n 127.0.0.1 my_topology.jar。

方法二:優化 ZooKeeper 配置

修改 Storm 配置文件 storm.yaml,調整 ZooKeeper 相關參數:

storm.zookeeper.session.timeout: 30000
storm.zookeeper.connection.timeout: 30000
storm.zookeeper.retry.times: 5
storm.zookeeper.retry.interval: 1000

方法三:檢查磁碟性能與網絡配置

  • 確保 ZooKeeper 數據目錄(storm.local.dir)位於高性能磁碟(SSD 優先)。
  • 在 /etc/hosts 中確保 localhost 正確解析為 127.0.0.1,必要時禁用 IPv6 回環。

驗證步驟

  1. 執行修正後的提交命令。
  2. 觀察控制台無 fsync 警告,且提示拓撲提交成功。
  3. 打開 Storm UI(預設 https://localhost:8080),確認拓撲出現在拓撲列表中並顯示運行狀態。

總結

核心解決途徑是顯式指定 Nimbus 主機,配合優化 ZooKeeper 超時配置與磁碟 I/O,可徹底解決 PyLeus 本地提交拓撲失敗且 UI 不可見的問題。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved