status 命令
复制代码
version 命令
1
2hbase(main):002:0> status 8 servers, 0 dead, 45.2500 average load
复制代码
create 命令1
2hbase(main):003:0> version 0.96.0-hadoop2-gphd-3.0.1.0, r40412e, Mon Apr 14 12:09:37 CST 2014
创建一个名为 Student 的表,这个表有两个列族为 info 和 score。其中表名、列族都要用单引号括起来
复制代码
list 命令1
2hbase(main):001:0> create 'Student','info','score' 0 row(s) in 2.0840 seconds
列出所有的表
复制代码
put 命令1
2
3
4hbase(main):002:0> list TABLE Test 1 row(s) in 0.0940 seconds
向表中插入数据,格式: put 表名,行名,列名([列族:列名]),值
复制代码
scan 命令1
2hbase(main):003:0> put 'Student','2014_SW02_25','info:name','tom' 0 row(s) in 0.1060 seconds
查看表中的所有数据
复制代码
get 命令1
2
3
4
5
6
7
8
9
10
11
12hbase(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
查看表中指定的数据
指定行
复制代码
指定行和列族
1
2
3
4
5
6
7
8
9
10hbase(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
复制代码
指定行、列族和列
1
2
3
4
5
6
7
8hbase(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
复制代码
指定行的前缀和记录数
1
2
3
4
5
6hbase(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
复制代码
指定入库时间区间查询
1hbase(main):041:0> scan 'Student',{LIMIT => 2, STARTROW => '2014_AC01'}
复制代码
count 命令1scan 'Student',{LIMIT => 2, TIMERANGE => [1417006187875, 1417007274669]}
统计表中有多少条记录
复制代码
exists 命令
1
2hbase(main):013:0> count 'Student' 2 row(s) in 0.0120 seconds
复制代码
delete 命令
1
2
3hbase(main):014:0> exists 'Student' Table Student does exist 0 row(s) in 0.0380 seconds
复制代码
truncate 命令1
2hbase(main):015:0> delete 'Student','2014_SW02_25','info:age' 0 row(s) in 0.0780 seconds
重建表(先删除)
复制代码
disable 、drop 命令1
2
3
4
5
6hbase(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
屏蔽表和删除表
复制代码
1
2
3
4hbase(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内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复