Hbase region空洞修復工具

2021-05-31 22:01:12 字數 1362 閱讀 6067

眾所周知,hbase 中隨著某個table 數量的增多必然會**成多個region,這些region 中的start-key 和 end-key 首位相連組成乙個閉環.如下圖所示

在表健康的時候可以用hbck工具來掃瞄整個表.結果當然是健康的狀態

hbase hbck -details

summary:

-root- is okay.

number of regions: 1

deployed on: dw72.kgb.sqa.cm4:60020

.meta. is okay.

number of regions: 1

deployed on: dw72.kgb.sqa.cm4:60020

tt1 is okay.

number of regions: 7

deployed on: dw71.kgb.sqa.cm4:60020 dw72.kgb.sqa.cm4:60020

0 inconsistencies detected.

status: ok

如果我們此時由於程式的原因或者由於誤操作,導致meta 表中的某行region資訊被刪除掉,則region 的start key 和end key 不能造成閉環. 導致某些region無法被讀寫.此處我特意手工刪掉一行以row-14069613為start key的region. 此時再用hbck scan 發現就會有錯誤資訊.

error: region hdfs: not in meta, but deployed on dw71.kgb.sqa.cm4:60020

chain of regions in table tt1 is broken; edges does not contain row-14069613

從提示 中可以看到這個table的region 出現了空洞. 此時修復空洞的工具可以出場了. 

hbase org.jruby.main check_meta.rb --fix 

.................

11/10/12 14:42:18 warn check_meta: hole after region => ]}}

11/10/12 14:42:19 info check_meta: plugged hole in .meta. at: region => ]}}

...........................

修復完了. hbck檢查一下發現ok了. check_meta.rb是用ruby寫的乙個小工具,原理其實十分簡單,主要檢測前面region info的end key 和 後面start key是否相等.如果不相等則表示有空洞,再讀取hdfs上的.regioninfo檔案獲取相應的資訊並寫入到meta table裡面去.**量非常少.

Hbase region查詢過程

hbase的table是該region切分的,client操作乙個row的時候,如何知道這個row對應的region是在哪台region server上呢?這裡有個region location過程。主要涉及到2張系統表,root meta.其結構見圖 在zookeeper的 hbase root ...

HBase Region 拆分與合併

region 自動拆分 hbase region 的自動拆分有 6 種觸發策略,如下 regionsplitpolicy 自動拆分策略的使用hbase.regionserver.region.split.policy org.apache.hadoop.hbase.regionserver.incr...

空洞檔案1

ls l file 檢視檔案邏輯大小 du c file 檢視檔案實際占用的儲存塊多少 od c file 檢視檔案儲存的內容 空洞檔案是個啥玩意?就是有空洞的檔案,在日常的常識中,我們使用的檔案存放在硬碟分割槽上的時候,有多大的內容就會占用多大的空間,比如這個文字檔案裡面寫有1000個asc字元,...