[HBase] HBase 安装&&小测试

下载

wget http://labs.renren.com/apache-mirror/hbase/hbase-0.90.5/hbase-0.90.5.tar.gz
tar -zxvf hbase-0.90.5.tar.gz 
cd hbase-0.90.5

运行

$ ./bin/start-hbase.sh 

进入hbase提供的shell

$ ./bin/hbase shell

一些操作

hbase(main):001:0> create "test","cf"
0 row(s) in 1.0460 seconds

hbase(main):002:0> list "test"
TABLE                                                                           
test                                                                            
1 row(s) in 0.0230 seconds

hbase(main):003:0> put "test","row1","cf:a","value1"
0 row(s) in 0.2210 seconds

hbase(main):004:0> put "test","row2","cf:b","value2"
0 row(s) in 0.0160 seconds

hbase(main):005:0> put "test","row3","cf:c","value3"
0 row(s) in 0.0200 seconds

hbase(main):006:0> scan "test"
ROW                   COLUMN+CELL                                               
 row1                 column=cf:a, timestamp=1339501920107, value=value1        
 row2                 column=cf:b, timestamp=1339501930057, value=value2        
 row3                 column=cf:c, timestamp=1339501943204, value=value3        
3 row(s) in 0.0670 seconds

hbase(main):007:0> get "test",'row1'
COLUMN                CELL                                                      
 cf:a                 timestamp=1339501920107, value=value1                     
1 row(s) in 0.0230 seconds

hbase(main):008:0> disable "test"
0 row(s) in 2.0800 seconds

hbase(main):009:0> drop "test"
0 row(s) in 1.1440 seconds

hbase(main):010:0> exit

停止HBase

./bin/stop-hbase.sh 
stopping hbase.......

posted on 2012-06-14 18:30  bluefrog  阅读(471)  评论(0编辑  收藏  举报