GitHub項目Storm-HBase簡介

來源:互聯網
上載者:User

最近完成了一個GitHub項目:Storm-HBase,該項目是Twitter Storm和Apache HBase的結合,它使用HBase cluster作為Storm的Spout資料來源,目前只是初步實現,後續會進一步完善。

HBaseSpout根據時間戳記範圍[start_timestamp, stop_timestamp],持續不間斷地從HBase cluster讀取流資料:

如果start_timestamp = 0,HBaseSpout將預設從3分鐘前的資料開始讀取並發送到Storm cluster;否則從使用者指定的start_timestamp開始讀取資料。

如果stop_timestamp = 0, HBaseSpout將預設讀取到目前時間的資料,並隨著時間流動持續地讀取新的資料並發送到Storm cluster;否則讀取到使用者指定的stop_timestamp後停止讀取。

以上有關[start_timestamp, stop_timestamp]的設計,是為了適應不同的運行模式:

最典型情況下,start_timestamp = 0 and stop_timestamp = 0,則從3分鐘前開始讀取發送資料,然後會同步掃描HBase cluster中的新資料,並發送給Storm cluster,適合使用者即時計算的情景。

出現問題的情況下,例如Storm cluster重啟,計算任務狀態被丟失,此時可能需要能夠Spout進行資料的回傳(data rewind),通過指定[start_timestamp, stop_timestamp]可以滿足這一需求。

Storm-HBase力求儘可能做到通用化,因此提取了Storm和HBase的配置資訊。有關Storm-HBase的配置選項,可以在GitHub工程的src/main/resources/storm.properties以及src/main/resources/hbase.properties檔案中找到。如果你的HBase表的Schema結構與上述類似,那麼只需要進行簡單的配置即可使用Storm-HBase。

目前的HBaseSpout實現基於以下假設:

HBase表的rowkey形式為[shardingkey, timestamp, ...];

shardingkey佔據第1個byte,表示表中資料的分區數,一般是100以內,所以這裡使用了short類型儲存;

timestamp佔據第2~5個byte,表示資料中的時間戳記資訊,這裡timestamp是秒級的UNIX時間戳記值,使用了int型儲存。

更多關於Storm-HBase的介紹及進展,請參加項目的GitHub連結:https://github.com/ypf412/storm-hbase

更多精彩內容:http://www.bianceng.cnhttp://www.bianceng.cn/database/extra/

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.