Hbase之shell命令的使用

shell命令

DDL(数据定义语言)
名称
描述
表达式
list列出存在哪些表list
desc/describe表描述信息desc ‘tableName’
create创建表 cf表示列族create ‘tableName’,’cf1’,’cf2’,’cf3’
alter添加列族alter ‘tableName’,’cf4’
删除列族(NAME,METHOD必须大写)alter ‘tableName’,{NAME=>’cf4’,METHOD=’delete’}
alter ‘tableName’,’delete’=>’cf4’
添加列族alter ‘tableName’,’cf4’
修改VERSIONSalter ‘tableName’,{NAME=>’cf4’,VERSIONS=>’3’}
删除表(需要先将表disable)drop ‘tableName’
is_disabled表是否被禁用is_disabled ‘tableName’
is_enabled表是否启用is_enabled ‘tableName’
is_enabled表是否启用is_enabled ‘tableName’
exists表是否存在exists ‘tableName’
disable禁用表disable ‘tableName’
DML(数据操纵语言)
名称
描述
表达式
count查看表中多少行count ‘tableName’
put添加记录(‘r1’代表rowkey)put ‘tableName’,’r1’,’cf1:name’,’123’
get查看指定rowkey的所有数据get ‘tableName’,’r1’
查看指定rowkey的指定cf或cq数据get ‘tableName’,’r1’,’cf1’,’cf2:name’
get ‘tableName’,’r1’,{COLUMN=>[‘cf1’,’cf2:name’]}
scan扫描整张表的数据scan ‘tableName’
扫描整个列族scan ‘tableName’,{COLUMN=>’cf1’}
扫描整个列scan ‘tableName’,{COLUMN=>’cf1:name’}
scan ‘tableName’,{COLUMN=>[‘cf1:name’,’cf2’]}
扫描整个列,查询前多少条数据STARTROW包括该rowkey,ENDROW不包括该rowkey,LIMIT查询多少条数据,(LIMIT与ENDROW并存时会取最小数据记录)scan ‘tableName’,{COLUMN=>’cf1:name’,STARTROW=>’r1’,LIMIT=>10,ENDROW=>’r3’}
delete根据rowkey删除某个celldelete ‘tableName’,’r1’,’cf1:name’,[timestamp]
deleteall删除整行数据deleteall ‘tableName’,’r1’

版权声明:本文为tpyqwe原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。