HBase 操作
0. 啟動HBase並確認所有服務都已啟動
1. 進入HBase Shell
shunfa@shunfa-vmmVBox:/opt/hbase-0.90.6$ bin/hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.90.6, r1295128, Wed Feb 29 14:29:21 UTC 2012
hbase(main):001:0>
- 試試help指令
hbase(main):001:0> help
1-1 資料庫操作-列出資料庫 list
hbase(main):002:0> list
TABLE
0 row(s) in 0.7890 seconds
1-2 資料庫操作-新增資料庫 create
hbase(main):003:0> create 'test', 'data'
0 row(s) in 1.4780 seconds
1-3 資料庫操作-新增紀錄 put
hbase(main):005:0> put 'test', 'row1', 'data:1', 'value1'
0 row(s) in 0.1180 seconds
hbase(main):007:0> put 'test', 'row2', 'data:2', 'value2'
0 row(s) in 0.0120 seconds
hbase(main):008:0> put 'test', 'row3', 'data:3', 'value3'
0 row(s) in 0.0090 seconds
1-4 資料庫操作-列出資料庫內容 scan
hbase(main):009:0> scan 'test'
ROW COLUMN+CELL
row1 column=data:1, timestamp=1355213278489, value=value1
row2 column=data:2, timestamp=1355213303215, value=value2
row3 column=data:3, timestamp=1355213310664, value=value3
3 row(s) in 0.0580 seconds
1-5 資料庫操作-刪除資料庫 disable and drop
1-6 離開
hbase(main):013:0> exit
shunfa@shunfa-vmmVBox:/opt/hbase-0.90.6$