Version 1 (modified by waue, 15 years ago) (diff) |
---|
Hbase 使用方法
HBase 0.20 + Hadoop 0.20
列出所有 table
hbase(main):> list
新增 table
- 直接增加一個表 t1
hbase(main):> create ‘t1’
- 增加一個擁有 ’f1’,’f2’,’fn’ 為 column family 的表: t2
hbase(main):> create ‘t2’,’f1’,’f2’,’fn’
加入cell-value
需先擁有表 t1 與column-family : f1
hbase(main):> put 't1', 'r1', 'f1:c1', 'value'
刪除 cell-value
hbase(main):> deleteall ‘t1’,’r1’
列出cell-value
hbase(main):> get 't1', 'r1'
- 執行結果參考
COLUMN CELL f1:c1 timestamp=1285041409509, value=value f1:c2 timestamp=1285041661078, value=9 get ‘t1’, ‘r1’, {column => ‘f1:c1’}
加入column family
hbase(main):> disable ‘t1’ hbase(main):> alter 't1', {NAME => 'f1'} hbase(main):> enable ‘t1’
刪除column family
hbase(main):> alter 't1', {NAME => 'f1', METHOD => 'delete'}
節點狀態
hbase(main):> status
刪除整張table
hbase(main):> truncate ‘t1’ hbase(main):> disable ‘t1’ hbase(main):> drop ‘t1’