概述
status 命令
hbase(main):002:0> status
8 servers, 0 dead, 45.2500 average load
version 命令
hbase(main):003:0> version
0.96.0-hadoop2-gphd-3.0.1.0, r40412e, Mon Apr 14 12:09:37 CST 2014
create 命令创建一个名为 Student 的表,这个表有两个列族为 info 和 score。其中表名、列族都要用单引号括起来
hbase(main):001:0> create 'Student','info','score'
0 row(s) in 2.0840 seconds
list 命令列出所有的表
hbase(main):002:0> list
TABLE
Test
1 row(s) in 0.0940 seconds
put 命令向表中插入数据,格式: put 表名,行名,列名([列族:列名]),值
hbase(main):003:0> put 'Student','2014_SW02_25','info:name','tom'
0 row(s) in 0.1060 seconds
scan 命令查看表中的所有数据
hbase(main):012:0> scan 'Student'
ROW
COLUMN+CELL
2014_SW02_18
column=info:name, timestamp=1417013170521, value=jack
2014_SW02_25
column=info:age, timestamp=1417012953351, value=23
2014_SW02_25
column=info:name, timestamp=1417012947503, value=tom
2014_SW02_25
column=score:math, timestamp=1417012957492, value=95
2 row(s) in 0.0220 seconds
get 命令查看表中指定的数据
指定行
hbase(main):007:0> get 'Student','2014_SW02_25'
COLUMN
CELL
info:age
timestamp=1417012953351, value=23
info:name
timestamp=1417012947503, value=tom
score:math
timestamp=1417012957492, value=95
3 row(s) in 0.0210 seconds
指定行和列族
hbase(main):008:0> get 'Student','2014_SW02_25','info'
COLUMN
CELL
info:age
timestamp=1417012953351, value=23
info:name
timestamp=1417012947503, value=tom
2 row(s) in 0.0180 seconds
指定行、列族和列
hbase(main):009:0> get 'Student','2014_SW02_25','info:name'
COLUMN
CELL
info:name
timestamp=1417012947503, value=tom
1 row(s) in 0.0200 seconds
指定行的前缀和记录数
hbase(main):041:0> scan 'Student',{LIMIT => 2, STARTROW => '2014_AC01'}
指定入库时间区间查询
scan 'Student',{LIMIT => 2, TIMERANGE => [1417006187875, 1417007274669]}
count 命令统计表中有多少条记录
hbase(main):013:0> count 'Student'
2 row(s) in 0.0120 seconds
exists 命令
hbase(main):014:0> exists 'Student'
Table Student does exist
0 row(s) in 0.0380 seconds
delete 命令
hbase(main):015:0> delete 'Student','2014_SW02_25','info:age'
0 row(s) in 0.0780 seconds
truncate 命令重建表(先删除)
hbase(main):029:0> truncate 'Student'
Truncating 'Student' table (it may take a while):
- Disabling table...
- Dropping table...
- Creating table...
0 row(s) in 1.9420 seconds
disable 、drop 命令屏蔽表和删除表
hbase(main):032:0> disable 'Student'
0 row(s) in 1.3510 seconds
hbase(main):035:0> drop 'Student'
0 row(s) in 0.2380 seconds
最后
以上就是柔弱嚓茶为你收集整理的Hbase - 常用命令的全部内容,希望文章能够帮你解决Hbase - 常用命令所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复