欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

淺談Storm在zookeeper上的目錄結(jié)構(gòu)

 更新時(shí)間:2017年10月16日 08:33:48   作者:不懂  
這篇文章主要介紹了淺談Storm在zookeeper上的目錄結(jié)構(gòu)的相關(guān)內(nèi)容,涉及storm使用zookeeper的操作以及詳細(xì)結(jié)構(gòu)圖,具有一定參考價(jià)值,需要的朋友可以了解下。

Storm的所有的狀態(tài)信息都保存在Zookeeper里面,nimbus通過(guò)在zookeeper上面寫(xiě)狀態(tài)信息來(lái)分配任務(wù):

使得nimbus可以監(jiān)控整個(gè)storm集群的狀態(tài),從而可以重啟一些掛掉的task。 ZooKeeper使得整個(gè)storm集群十分的健壯-—任何一臺(tái)工作機(jī)器掛掉都沒(méi)有關(guān)系,只要重啟然后從zookeeper上面重新獲取狀態(tài)信息就可以了。那Storm在zookeeper里面存儲(chǔ)了哪些狀態(tài)呢?在James Xu的文章中有所涉及,但是該文章講述的已經(jīng)過(guò)時(shí)了。本文主要介紹Storm在ZooKeeper中保存的數(shù)據(jù)目錄結(jié)構(gòu),源代碼主要是:backtype.storm.cluster。

關(guān)于storm操作zookeeper的詳細(xì)分析請(qǐng)參見(jiàn):源碼閱讀之storm操作zookeeper-cluster.clj

Zookeeper的操作

(defprotocol ClusterState
 (set-ephemeral-node [this path data])
 (delete-node [this path])
 (create-sequential [this path data])
 (set-data [this path data]) ;; if node does not exist, create persistent with this data 
 (get-data [this path watch?])
 (get-children [this path watch?])
 (mkdirs [this path])
 (close [this])
 (register [this callback])
 (unregister [this id])
 )

Storm使用Zookeeper的操作

(defprotocol StormClusterState
 (assignments [this callback])
 (assignment-info [this storm-id callback])
 (active-storms [this])
 (storm-base [this storm-id callback])
 (get-worker-heartbeat [this storm-id node port])
 (executor-beats [this storm-id executor->node+port])
 (supervisors [this callback])
 (supervisor-info [this supervisor-id]) ;; returns nil if doesn't exist
 (setup-heartbeats! [this storm-id])
 (teardown-heartbeats! [this storm-id])
 (teardown-topology-errors! [this storm-id])
 (heartbeat-storms [this])
 (error-topologies [this])
 (worker-heartbeat! [this storm-id node port info])
 (remove-worker-heartbeat! [this storm-id node port])
 (supervisor-heartbeat! [this supervisor-id info])
 (activate-storm! [this storm-id storm-base])
 (update-storm! [this storm-id new-elems])
 (remove-storm-base! [this storm-id])
 (set-assignment! [this storm-id info])
 (remove-storm! [this storm-id])
 (report-error [this storm-id task-id error])
 (errors [this storm-id task-id])
 (disconnect [this])
 )

Storm中在Zookeeper中存儲(chǔ)的目錄

(def ASSIGNMENTS-ROOT "assignments")
(def CODE-ROOT "code")
(def STORMS-ROOT "storms")
(def SUPERVISORS-ROOT "supervisors")
(def WORKERBEATS-ROOT "workerbeats")
(def ERRORS-ROOT "errors")

(def ASSIGNMENTS-SUBTREE (str "/" ASSIGNMENTS-ROOT))
(def STORMS-SUBTREE (str "/" STORMS-ROOT))
(def SUPERVISORS-SUBTREE (str "/" SUPERVISORS-ROOT))
(def WORKERBEATS-SUBTREE (str "/" WORKERBEATS-ROOT))
(def ERRORS-SUBTREE (str "/" ERRORS-ROOT))

1./assignments -> 任務(wù)分配信息
2./storms -> 正在運(yùn)行的topology的ID
3./supervisors -> 所有的Supervisors的心跳信息
4./workerbeats -> 所有的Worker的心跳
5./errors -> 產(chǎn)生的出錯(cuò)信息

結(jié)構(gòu)圖

/-{storm-zk-root}      -- storm在zookeeper上的根目錄(默認(rèn)為/storm)
 |
 |-/assignments      -- topology的任務(wù)分配信息
 |  |
 |  |-/{topology-id}   -- 這個(gè)目錄保存的是每個(gè)topology的assignments信息包括:對(duì)應(yīng)的nimbus上
 |             -- 的代碼目錄,所有task的啟動(dòng)時(shí)間,每個(gè)task與機(jī)器、端口的映射。操作為
 |             -- (assignments)來(lái)獲取所有assignments的值;以及(assignment-info storm-id)
 |             -- 來(lái)得到給定的storm-id對(duì)應(yīng)的AssignmentInfo信息
 |             -- 在A(yíng)ssignmentInfo中存儲(chǔ)的內(nèi)容有:
 |             -- :executor->node+port :executor->start-time-secs :node->host
 |             -- 具體定義在common.clj中的
 |             -- (defrecord Assignment[master-code-dir node->host executor->node+port                  executor->start-time-secs])            
 |
 |-/storms         -- 這個(gè)目錄保存所有正在運(yùn)行的topology的id
 |  |
 |  |
 |  |-/{topology-id}   -- 這個(gè)文件保存這個(gè)topology的一些信息,包括topology的名字,topology開(kāi)始運(yùn)行
 |             -- 的時(shí)間以及這個(gè)topology的狀態(tài)。操作(active-storms),獲得當(dāng)前路徑活躍的下
 |             -- topology數(shù)據(jù)。保存的內(nèi)容參考類(lèi)StormBase;(storm-base storm-id)得到給定的
 |             -- storm-id下的StormBase數(shù)據(jù),具體定義在common.clj中的
 |   -- (defrecord StormBase [storm-name launch-time-secs status num-workers component->executors])
 |
 |-/supervisors      -- 這個(gè)目錄保存所有的supervisor的心跳信息
 |  |            
 |  |
 |  |-/{supervisor-id}  -- 這個(gè)文件保存supervisor的心跳信息包括:心跳時(shí)間,主機(jī)名,這個(gè)supervisor上
 |             -- worker的端口號(hào),運(yùn)行時(shí)間(具體看SupervisorInfo類(lèi))。操作(supervisors)得到
 |             -- 所有的supervisors節(jié)點(diǎn);(supervisor-info supervisor-id)得到給定的
 |             -- supervisor-id對(duì)應(yīng)的SupervisorInfo信息;具體定義在common.clj中的
 |              
 |    -- (defrecord SupervisorInfo [time-secs hostname assignment-id used-ports meta scheduler-meta       uptime-secs])
 |
 |-/workerbeats          -- 所有worker的心跳
 |  |
 |  |-/{topology-id}       -- 這個(gè)目錄保存這個(gè)topology的所有的worker的心跳信息
 |    |
 |    |-/{supervisorId-port}  -- worker的心跳信息,包括心跳的時(shí)間,worker運(yùn)行時(shí)間以及一些統(tǒng)計(jì)信息
 |                    
 |                 -- 操作(heartbeat-storms)得到所有有心跳數(shù)據(jù)的topology,
 |                 -- (get-worker-heartbeat storm-id node port)得到具體一個(gè)topology下
 |                 -- 的某個(gè)worker(node:port)的心跳狀況,
 |             -- (executor-beats storm-id executor->node+port)得到一個(gè)executor的心跳狀況
 |
 |-/errors         -- 所有產(chǎn)生的error信息
 |
 |-/{topology-id}      -- 這個(gè)目錄保存這個(gè)topology下面的錯(cuò)誤信息。操作(error-topologies)得到出錯(cuò)
   |           -- 的topology;(errors storm-id component-id)得到
   |           -- 給定的storm-id component-id下的出錯(cuò)信息
   |-/{component-id}

總結(jié)

以上就是本文關(guān)于淺談Storm在zookeeper上的目錄結(jié)構(gòu)的全部?jī)?nèi)容,感興趣的朋友可以參閱:apache zookeeper使用方法實(shí)例詳解、為zookeeper配置相應(yīng)的acl權(quán)限zookeeper watch機(jī)制的理解等,如有不足之處,歡迎留言指出,希望對(duì)大家有所幫助。感謝朋友們對(duì)本站的支持!

相關(guān)文章

最新評(píng)論