1. 程式人生 > >hbase在hdfs上的詳細目錄結構

hbase在hdfs上的詳細目錄結構

hbase目錄結構如圖:

 列出/hbase目錄下的所有目錄和檔案,結構如下:

drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/.tmp
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/.tmp/data
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/.tmp/data/hbase

drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/MasterProcWALs
-rw-r--r--   1 root supergroup          0 2018-10-27 18:26 /hbase/MasterProcWALs/state-00000000000000000003.log

drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/WALs
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/WALs/bigdata111,16201,1540635983442
-rw-r--r--   1 root supergroup         83 2018-10-27 18:26 /hbase/WALs/bigdata111,16201,1540635983442/bigdata111%2C16201%2C1540635983442.1540635991168
-rw-r--r--   1 root supergroup         83 2018-10-27 18:26 /hbase/WALs/bigdata111,16201,1540635983442/bigdata111%2C16201%2C1540635983442.meta.1540635991546.meta

drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/data
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/data/default
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/data/hbase
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/data/hbase/meta
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/data/hbase/meta/.tabledesc
-rw-r--r--   1 root supergroup        398 2018-10-27 18:26 /hbase/data/hbase/meta/.tabledesc/.tableinfo.0000000001
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/data/hbase/meta/.tmp
drwxr-xr-x   - root supergroup          0 2018-10-27 18:36 /hbase/data/hbase/meta/1588230740
-rw-r--r--   1 root supergroup         32 2018-10-27 18:26 /hbase/data/hbase/meta/1588230740/.regioninfo
drwxr-xr-x   - root supergroup          0 2018-10-27 18:36 /hbase/data/hbase/meta/1588230740/.tmp
drwxr-xr-x   - root supergroup          0 2018-10-27 18:36 /hbase/data/hbase/meta/1588230740/info
-rw-r--r--   1 root supergroup       5397 2018-10-27 18:36 /hbase/data/hbase/meta/1588230740/info/eae735e8d1824bffa04eed7336397113
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/data/hbase/meta/1588230740/recovered.edits
-rw-r--r--   1 root supergroup          0 2018-10-27 18:26 /hbase/data/hbase/meta/1588230740/recovered.edits/3.seqid
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/data/hbase/namespace
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/data/hbase/namespace/.tabledesc
-rw-r--r--   1 root supergroup        312 2018-10-27 18:26 /hbase/data/hbase/namespace/.tabledesc/.tableinfo.0000000001
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/data/hbase/namespace/.tmp
drwxr-xr-x   - root supergroup          0 2018-10-27 18:36 /hbase/data/hbase/namespace/8a0cf0539605aa1c70908eac9a24da58
-rw-r--r--   1 root supergroup         42 2018-10-27 18:26 /hbase/data/hbase/namespace/8a0cf0539605aa1c70908eac9a24da58/.regioninfo
drwxr-xr-x   - root supergroup          0 2018-10-27 18:36 /hbase/data/hbase/namespace/8a0cf0539605aa1c70908eac9a24da58/.tmp
drwxr-xr-x   - root supergroup          0 2018-10-27 18:36 /hbase/data/hbase/namespace/8a0cf0539605aa1c70908eac9a24da58/info
-rw-r--r--   1 root supergroup       4963 2018-10-27 18:36 /hbase/data/hbase/namespace/8a0cf0539605aa1c70908eac9a24da58/info/6f69ab990ede4b1f9f5dc42d83c56b48
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/data/hbase/namespace/8a0cf0539605aa1c70908eac9a24da58/recovered.edits
-rw-r--r--   1 root supergroup          0 2018-10-27 18:26 /hbase/data/hbase/namespace/8a0cf0539605aa1c70908eac9a24da58/recovered.edits/2.seqid
-rw-r--r--   1 root supergroup         42 2018-10-27 18:26 /hbase/hbase.id
-rw-r--r--   1 root supergroup          7 2018-10-27 18:26 /hbase/hbase.version
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/oldWALs

/hbase下包含2個檔案和5個目錄。

(1)hbase.id

hbase.id檔案記錄了hbase的id,具體內容如下:

PBUF
$3eee3dad-50e2-4dc7-84a3-e1a8b80a0064

(2)hbase.version

hbase.version記錄了hbase的版本,是一個二進位制檔案,內容如圖:

(3).tmp

.tmp是臨時目錄,是一個空目錄,如圖:

(4)MasterProcWALs

MasterProcWALs目錄下含有一個HMaster主節點狀態日誌檔案,如圖:

起初,日誌內容為空

(5)WALs

日誌目錄,子目錄結構如圖:

其中bigdata111%2C16201%2C1540635983442.1540635991168日誌內容如圖:

(6)oldWALs

hbase操作相關的舊日誌存放目錄,如圖:

(7)data

data目錄是最重要的目錄,儲存hbase資料,下面含有兩個名稱空間default和hbase,其中default是預設名稱空間,如果建立的表未指定名稱空間,將存放在該名稱空間下,habse是系統名稱空間,他們分別對應default和hbase目錄,其中剛開始default目錄為空,而hbase目錄結構如下:

 

2、HBase相關操作後目錄變化

 建立表mytable

create 'mytable','cf'

之後,目錄結構如下:

drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/.tmp
drwxr-xr-x   - root supergroup          0 2018-10-27 18:57 /hbase/.tmp/data
drwxr-xr-x   - root supergroup          0 2018-10-27 18:57 /hbase/.tmp/data/default
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/.tmp/data/hbase
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/MasterProcWALs
-rw-r--r--   1 root supergroup        461 2018-10-27 18:26 /hbase/MasterProcWALs/state-00000000000000000003.log
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/WALs
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/WALs/bigdata111,16201,1540635983442
-rw-r--r--   1 root supergroup         83 2018-10-27 18:26 /hbase/WALs/bigdata111,16201,1540635983442/bigdata111%2C16201%2C1540635983442.1540635991168
-rw-r--r--   1 root supergroup         83 2018-10-27 18:26 /hbase/WALs/bigdata111,16201,1540635983442/bigdata111%2C16201%2C1540635983442.meta.1540635991546.meta
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/data
drwxr-xr-x   - root supergroup          0 2018-10-27 18:57 /hbase/data/default
drwxr-xr-x   - root supergroup          0 2018-10-27 18:57 /hbase/data/default/mytable
drwxr-xr-x   - root supergroup          0 2018-10-27 18:57 /hbase/data/default/mytable/.tabledesc
-rw-r--r--   1 root supergroup        285 2018-10-27 18:57 /hbase/data/default/mytable/.tabledesc/.tableinfo.0000000001
drwxr-xr-x   - root supergroup          0 2018-10-27 18:57 /hbase/data/default/mytable/.tmp
drwxr-xr-x   - root supergroup          0 2018-10-27 18:57 /hbase/data/default/mytable/bcc4a32d806193ddf0600d026237ff8b
-rw-r--r--   1 root supergroup         42 2018-10-27 18:57 /hbase/data/default/mytable/bcc4a32d806193ddf0600d026237ff8b/.regioninfo
drwxr-xr-x   - root supergroup          0 2018-10-27 18:57 /hbase/data/default/mytable/bcc4a32d806193ddf0600d026237ff8b/cf
drwxr-xr-x   - root supergroup          0 2018-10-27 18:57 /hbase/data/default/mytable/bcc4a32d806193ddf0600d026237ff8b/recovered.edits
-rw-r--r--   1 root supergroup          0 2018-10-27 18:57 /hbase/data/default/mytable/bcc4a32d806193ddf0600d026237ff8b/recovered.edits/2.seqid
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/data/hbase
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/data/hbase/meta
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/data/hbase/meta/.tabledesc
-rw-r--r--   1 root supergroup        398 2018-10-27 18:26 /hbase/data/hbase/meta/.tabledesc/.tableinfo.0000000001
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/data/hbase/meta/.tmp
drwxr-xr-x   - root supergroup          0 2018-10-27 18:36 /hbase/data/hbase/meta/1588230740
-rw-r--r--   1 root supergroup         32 2018-10-27 18:26 /hbase/data/hbase/meta/1588230740/.regioninfo
drwxr-xr-x   - root supergroup          0 2018-10-27 18:36 /hbase/data/hbase/meta/1588230740/.tmp
drwxr-xr-x   - root supergroup          0 2018-10-27 18:36 /hbase/data/hbase/meta/1588230740/info
-rw-r--r--   1 root supergroup       5397 2018-10-27 18:36 /hbase/data/hbase/meta/1588230740/info/eae735e8d1824bffa04eed7336397113
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/data/hbase/meta/1588230740/recovered.edits
-rw-r--r--   1 root supergroup          0 2018-10-27 18:26 /hbase/data/hbase/meta/1588230740/recovered.edits/3.seqid
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/data/hbase/namespace
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/data/hbase/namespace/.tabledesc
-rw-r--r--   1 root supergroup        312 2018-10-27 18:26 /hbase/data/hbase/namespace/.tabledesc/.tableinfo.0000000001
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/data/hbase/namespace/.tmp
drwxr-xr-x   - root supergroup          0 2018-10-27 18:36 /hbase/data/hbase/namespace/8a0cf0539605aa1c70908eac9a24da58
-rw-r--r--   1 root supergroup         42 2018-10-27 18:26 /hbase/data/hbase/namespace/8a0cf0539605aa1c70908eac9a24da58/.regioninfo
drwxr-xr-x   - root supergroup          0 2018-10-27 18:36 /hbase/data/hbase/namespace/8a0cf0539605aa1c70908eac9a24da58/.tmp
drwxr-xr-x   - root supergroup          0 2018-10-27 18:36 /hbase/data/hbase/namespace/8a0cf0539605aa1c70908eac9a24da58/info
-rw-r--r--   1 root supergroup       4963 2018-10-27 18:36 /hbase/data/hbase/namespace/8a0cf0539605aa1c70908eac9a24da58/info/6f69ab990ede4b1f9f5dc42d83c56b48
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/data/hbase/namespace/8a0cf0539605aa1c70908eac9a24da58/recovered.edits
-rw-r--r--   1 root supergroup          0 2018-10-27 18:26 /hbase/data/hbase/namespace/8a0cf0539605aa1c70908eac9a24da58/recovered.edits/2.seqid
-rw-r--r--   1 root supergroup         42 2018-10-27 18:26 /hbase/hbase.id
-rw-r--r--   1 root supergroup          7 2018-10-27 18:26 /hbase/hbase.version
drwxr-xr-x   - root supergroup          0 2018-10-27 18:26 /hbase/oldWALs

目錄變化:

.tmp目錄:增加了/hbase/.tmp/data/default 空目錄;

MasterProcWALs目錄:state-00000000000000000003.log中記錄了操作日誌,一段時間見後會被刪除,重新建立state-00000000000000000004.log空白日誌檔案;

WALs目錄:記錄建立表的相關日誌;

data目錄:增加了mytable目錄,結構如下:

drwxr-xr-x   - root supergroup          0 2018-10-27 18:57 /hbase/data/default/mytable
drwxr-xr-x   - root supergroup          0 2018-10-27 18:57 /hbase/data/default/mytable/.tabledesc
-rw-r--r--   1 root supergroup        285 2018-10-27 18:57 /hbase/data/default/mytable/.tabledesc/.tableinfo.0000000001
drwxr-xr-x   - root supergroup          0 2018-10-27 18:57 /hbase/data/default/mytable/.tmp
drwxr-xr-x   - root supergroup          0 2018-10-27 18:57 /hbase/data/default/mytable/bcc4a32d806193ddf0600d026237ff8b
-rw-r--r--   1 root supergroup         42 2018-10-27 18:57 /hbase/data/default/mytable/bcc4a32d806193ddf0600d026237ff8b/.regioninfo
drwxr-xr-x   - root supergroup          0 2018-10-27 18:57 /hbase/data/default/mytable/bcc4a32d806193ddf0600d026237ff8b/cf
drwxr-xr-x   - root supergroup          0 2018-10-27 18:57 /hbase/data/default/mytable/bcc4a32d806193ddf0600d026237ff8b/recovered.edits
-rw-r--r--   1 root supergroup          0 2018-10-27 18:57 /hbase/data/default/mytable/bcc4a32d806193ddf0600d026237ff8b/recovered.edits/2.seqid

 插入資料後,cf目錄下不會立即生成資料檔案,而是儲存在記憶體(MemStore)中,當執行stop-hbase.sh關閉HBase後會將資料重新整理到檔案中,如圖:

刪除表後增加/archive目錄,刪除的表放入該目錄下,如圖:

drwxr-xr-x   - root supergroup          0 2018-10-27 20:03 /hbase/archive/data
drwxr-xr-x   - root supergroup          0 2018-10-27 20:03 /hbase/archive/data/default
drwxr-xr-x   - root supergroup          0 2018-10-27 20:03 /hbase/archive/data/default/mytable
drwxr-xr-x   - root supergroup          0 2018-10-27 20:03 /hbase/archive/data/default/mytable/bcc4a32d806193ddf0600d026237ff8b
drwxr-xr-x   - root supergroup          0 2018-10-27 20:03 /hbase/archive/data/default/mytable/bcc4a32d806193ddf0600d026237ff8b/cf
-rw-r--r--   1 root supergroup       5004 2018-10-27 20:03 /hbase/archive/data/default/mytable/bcc4a32d806193ddf0600d026237ff8b/cf/eab191595e614af0b75e14475fd58eca
drwxr-xr-x   - root supergroup          0 2018-10-27 20:03 /hbase/archive/data/default/mytable/bcc4a32d806193ddf0600d026237ff8b/cf-2
-rw-r--r--   1 root supergroup       4930 2018-10-27 20:03 /hbase/archive/data/default/mytable/bcc4a32d806193ddf0600d026237ff8b/cf-2/d26b377dfb8c43e4abee2d5e79a7180d
drwxr-xr-x   - root supergroup          0 2018-10-27 20:03 /hbase/archive/data/default/mytable/bcc4a32d806193ddf0600d026237ff8b/recovered.edits
-rw-r--r--   1 root supergroup          0 2018-10-27 20:03 /hbase/archive/data/default/mytable/bcc4a32d806193ddf0600d026237ff8b/recovered.edits/22.seqid