-
轉自:http://zhb-mccoy.iteye.com/blog/1543492
The HRegionServer opens the region and creates a corresponding HRegion object. When
the HRegion is opened it sets up a Store instance for each HColumnFamily for every table
as defined by the user beforehand. Each Store instance can, in turn, have one or more
StoreFile instances, which are lightweight wrappers around the actual storage file
called HFile. A Store also has a MemStore, and the HRegionServer a shared HLog in-stance。
原博客沒有翻譯,我這里大體翻譯一下:RegionServer打開一個region的時候,會創建一個相應的HRegion對象。當這個HRegion被打開,他會為每一個表中的
每一個列簇創建一個Stroe實例,就想用戶之前創建的那樣。每一個Store實例相應地有一個或者多個StoreFile實例,StoreFile是對真正存儲數據的文件(HFile)的
輕量級封裝。一個Store還會有一個Memstore。每一個HRegionServer中的所有東西會共享一個HLog實例。
結合前面的圖看就很清晰了。
hbase table中每個列簇都對應着region中的一個store,在hdfs系統中則對應着一個目錄,如果列簇中尚無數據,怎該目錄為空,也就是該store下還沒有storefile。
1.house_hire_analysis 表中列簇total下無數據,另一張表fangyuan下有數據:
2.查看hdfs region下的內容
3. hbase console 如圖:
4.put一條記錄到house_hire_analysis中,並flush,flush將改動從memstore刷新到磁盤
5. hbase cosole storefile已經增加
6.新flush的kv根據策略會分別存到不同的storefiles中(最后compaction 會將這些小文件合並)