# 'hbase_test':表名,''不能丢
# {NAME => 'f1',VERSION => 1}:列簇,'f1'表示列簇名称,NAME => '':格式必须这样写
create 'hbase_test',{NAME => 'f1',VERSION => 1},{NAME => 'f2',VERSION => 1},{NAME => 'f3',VERSION => 1}
list
:显示所有表相当于show tables
desc 'hbase_test'
:查看表结构
# 关闭表
disable 'hbase_test'
# 删除表
drop 'hbase_test'
enable 'hbase_test'
truncate 'hbase_test'
# 'hbase_test':表名
# '001':表示行键
# 'f1:name':列簇下字段名
# 'liubei':字段名的值
put 'hbase_test','001','f1:name','liubei'
put 'hbase_test','001','f2:age','30'
put 'hbase_test','001','f3:sex','male'
put 'hbase_test','002','f1:name','guanyu'
put 'hbase_test','002','f2:age','28'
put 'hbase_test','002','f3:sex','female'
put 'hbase_test','003','f1:name','zhangfei'
put 'hbase_test','003','f2:age','27'
put 'hbase_test','003','f3:sex','male'
# 相当于sql语句 select * from hbase_test
scan 'hbase_test'
# 查询hbase_test表中的f1列簇
scan 'hbase_test',{COLUMNS => 'f1'}
# 查询hbase_test表中的f1列簇中name字段
scan 'hbase_test',{COLUMNS => 'f1:name'}
# 查询hbase_test表的f1,f2列簇
scan 'hbase_test',{COLUMNS => ['f1','f2']}
# 查询hbase_test表的f1列簇的name字段,f2列簇的age字段
scan 'hbase_test',{COLUMNS => ['f1:name','f2:age']}
# 查询hbase_test的f1列簇,从行键从001-003,不包括003
scan 'hbase_test',{COLUMNS => 'f1', STARTROW => '001',ENDROW => '003'}
# 查询hbase_test表,001行键
get 'hbase_test','001'
get 'hbase_test','001','f1:name'
get 'hbase_test','002','f2:age'
get 'hbase_test','003','f3:sex'
删除数据
# 删除行键001那一行
deleteall 'hbase_test','001'
# 删除行键002中的f1:name字段
delete 'hbase_test','002','f1:name'