使用 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 事務日誌寫入磁碟耗時過長,嚴重影響操作延遲。
此問題通常由以下原因導致:
0:0:0:0:0:0:0:1,可能導致連接不穩定。在提交命令中使用 -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。
修改 Storm 配置文件 storm.yaml,調整 ZooKeeper 相關參數:
storm.zookeeper.session.timeout: 30000
storm.zookeeper.connection.timeout: 30000
storm.zookeeper.retry.times: 5
storm.zookeeper.retry.interval: 1000
storm.local.dir)位於高性能磁碟(SSD 優先)。/etc/hosts 中確保 localhost 正確解析為 127.0.0.1,必要時禁用 IPv6 回環。fsync 警告,且提示拓撲提交成功。https://localhost:8080),確認拓撲出現在拓撲列表中並顯示運行狀態。核心解決途徑是顯式指定 Nimbus 主機,配合優化 ZooKeeper 超時配置與磁碟 I/O,可徹底解決 PyLeus 本地提交拓撲失敗且 UI 不可見的問題。