我是靠谱客的博主 柔弱嚓茶,这篇文章主要介绍Hbase - 常用命令,现在分享给大家,希望可以做个参考。

status 命令

复制代码
1
2
hbase(main):002:0> status 8 servers, 0 dead, 45.2500 average load
version 命令
复制代码
1
2
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。其中表名、列族都要用单引号括起来

复制代码
1
2
hbase(main):001:0> create 'Student','info','score' 0 row(s) in 2.0840 seconds
list 命令
    列出所有的表

复制代码
1
2
3
4
hbase(main):002:0> list TABLE Test 1 row(s) in 0.0940 seconds
put 命令
    向表中插入数据,格式: put 表名,行名,列名([列族:列名]),值

复制代码
1
2
hbase(main):003:0> put 'Student','2014_SW02_25','info:name','tom' 0 row(s) in 0.1060 seconds
scan 命令

    查看表中的所有数据

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
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 命令
    查看表中指定的数据
        指定行

复制代码
1
2
3
4
5
6
7
8
9
10
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
        指定行和列族
复制代码
1
2
3
4
5
6
7
8
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
        指定行、列族和列
复制代码
1
2
3
4
5
6
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
        指定行的前缀和记录数
复制代码
1
hbase(main):041:0> scan 'Student',{LIMIT => 2, STARTROW => '2014_AC01'}
        指定入库时间区间查询
复制代码
1
scan 'Student',{LIMIT => 2, TIMERANGE => [1417006187875, 1417007274669]}
count 命令
    统计表中有多少条记录

复制代码
1
2
hbase(main):013:0> count 'Student' 2 row(s) in 0.0120 seconds
exists 命令
复制代码
1
2
3
hbase(main):014:0> exists 'Student' Table Student does exist 0 row(s) in 0.0380 seconds
delete 命令
复制代码
1
2
hbase(main):015:0> delete 'Student','2014_SW02_25','info:age' 0 row(s) in 0.0780 seconds
truncate 命令
    重建表(先删除)

复制代码
1
2
3
4
5
6
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 命令
    屏蔽表和删除表

复制代码
1
2
3
4
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内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(69)

评论列表共有 0 条评论

立即
投稿
返回
顶部