2.HBase的shell操作

语句 功能
进入hbase客户端 bin/hbase shell
查看帮助命令 help
查看数据库 list_namespace
创建数据库 create_namespace 'test'
查看数据库下的表 list
创建表 create 'student','info'
插入数据到表 put 'student','1001','info:sex','male'
扫描查看表数据 scan 'test:student'
scan 'test:student',{STARTROW => '1001', STOPROW => '1001'}
scan 'test:student',{STARTROW => '1001'}
查看表结构 describe ‘test:student’
查看“指定行”或“指定列族:列”的数据 get 'test:student','1001'
get 'test:student','1001','info:name'
统计表数据行数 count 'test:student'
删除数据 删除某rowkey全部数据 -> deleteall 'test:student','1001'
删除某rowkey某一列数据 -> delete 'test:student','1002','info:sex'
清空表数据 truncate 'test:student'
删除表 disable 'test:student'
drop 'test:student'
变更表信息 alter 'student',{NAME=>'info',VERSIONS=>3}
get 'student','1001',{COLUMN=>'info:name',VERSIONS=>3}

你可能感兴趣的:(2.HBase的shell操作)