[2] HBase表的基本操作

 

[hadoopuser@master  hbase-0.20.3]$ bin/hbase shell

HBase Shell; enter 'help<RETURN>' for list of supported commands.

Version: 0.20.3, rUnknown, Fri Apr  9 11:15:50 CST 2010

hbase(main):001:0> list (显示所有的表)

scores

xuser

2 row(s) in 0.1600 seconds


hbase(main):002:0> create 'xuser','user','file' (创建表xuser,有两个列组 user和file)


hbase(main):003:0> put 'xuser','279470','user:username','[email protected]'


hbase(main):004:0> put 'xuser','279470','file:fileid','212414444'


hbase(main):005:0> put 'xuser','279470','file:filename','天使'


hbase(main):006:0> put 'xuser','279470','file:filetype','mp3'


hbase(main):007:0> put 'xuser','111111','user:username','[email protected]'


hbase(main):008:0> put 'xuser','111111','file:fileid','315556676'


hbase(main):009:0> put 'xuser','111111','file:filename','夕阳天使'


hbase(main):010:0> put 'xuser','111111','file:filetype','avi'


hbase(main):011:0> get 'xuser','279470'  (获得279470这个用户的所有信息)

 

hbase(main):012:0> get 'xuser','tom',{COLUMN=>'file:filename'}


hbase(main):013:0> scan 'xuser'    (扫描整个表信息)


hbase(main):014:0> disable 'xuser' (删除表之前要先执行这一步)


hbase(main):015:0> drop 'xuser'  (删除表)

 

 

 

你可能感兴趣的:(hbase)