Hbase的常用shell操作
来源:互联网 发布:淘宝爱玩电玩数码店 编辑:程序博客网 时间:2024/06/15 18:17
Hbase的常用shell操作
标签: shellhbasehbaseshellscanhdfs
2017-02-08 10:30 538人阅读 评论(0)收藏举报
![](http://static.blog.csdn.net/images/category_icon.jpg)
作者同类文章X
版权声明:本文为博主原创文章,未经博主允许不得转载。
- 1.进入hbase的shell界面:
[root@lijie bin]# ./hbase shell
- 1
![](http://static.blog.csdn.net/images/save_snippets.png)
- 1
- 2.创建表
hbase(main):002:0> create 'tablename','cf1','cf2'0 row(s) in 0.5830 seconds=> Hbase::Table - tablename
- 1
- 2
- 3
- 4
![](http://static.blog.csdn.net/images/save_snippets.png)
- 1
- 2
- 3
- 4
- 3.列出所有表
hbase(main):003:0> listTABLE stu t1 tablename 3 row(s) in 0.0100 seconds=> ["stu", "t1", "tablename"]
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
![](http://static.blog.csdn.net/images/save_snippets.png)
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 4.插入数据
hbase(main):005:0> put 'tablename','rowkey01','cf1:name','lijie'0 row(s) in 0.0570 secondshbase(main):006:0> put 'tablename','rowkey01','cf1:addr','chongqing'0 row(s) in 0.0070 seconds
- 1
- 2
- 3
- 4
- 5
- 6
![](http://static.blog.csdn.net/images/save_snippets.png)
- 1
- 2
- 3
- 4
- 5
- 6
- 5.查看表的所有数据
hbase(main):012:0> scan 'tablename'ROW COLUMN+CELL rowkey01 column=cf1:addr, timestamp=1486547683853, value=chongqing rowkey01 column=cf1:name, timestamp=1486547607486, value=lijie rowkey02 column=cf1:addr, timestamp=1486547771954, value=shenzhen rowkey02 column=cf1:name, timestamp=1486547737573, value=zhangsan 2 row(s) in 0.0280 seconds
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
![](http://static.blog.csdn.net/images/save_snippets.png)
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 6.根据rowkey查看数据
hbase(main):015:0> get 'tablename','rowkey01'COLUMN CELL cf1:addr timestamp=1486547683853, value=chongqing cf1:name timestamp=1486547607486, value=lijie 2 row(s) in 0.0250 seconds
- 1
- 2
- 3
- 4
- 5
- 6
![](http://static.blog.csdn.net/images/save_snippets.png)
- 1
- 2
- 3
- 4
- 5
- 6
- 7.查询数据的条数
hbase(main):016:0> count 'tablename'2 row(s) in 0.0410 seconds=> 2
- 1
- 2
- 3
- 4
- 5
![](http://static.blog.csdn.net/images/save_snippets.png)
- 1
- 2
- 3
- 4
- 5
- 8.获取一行指定列族的数据
hbase(main):017:0> get 'tablename','rowkey01','cf1'COLUMN CELL cf1:addr timestamp=1486547683853, value=chongqing cf1:name timestamp=1486547607486, value=lijie 2 row(s) in 0.0120 seconds
- 1
- 2
- 3
- 4
- 5
- 6
![](http://static.blog.csdn.net/images/save_snippets.png)
- 1
- 2
- 3
- 4
- 5
- 6
- 9.获取一行指定列族某列数据
hbase(main):021:0> get 'tablename','rowkey01','cf1:name'COLUMN CELL cf1:name timestamp=1486547607486, value=lijie 1 row(s) in 0.0080 seconds
- 1
- 2
- 3
- 4
![](http://static.blog.csdn.net/images/save_snippets.png)
- 1
- 2
- 3
- 4
- 10.删除列族
hbase(main):027:0> delete 'tablename','rowkey01','cf1:addr'0 row(s) in 0.0030 seconds
- 1
- 2
- 3
![](http://static.blog.csdn.net/images/save_snippets.png)
- 1
- 2
- 3
- 11.删除一整行数据
hbase(main):029:0> deleteall 'tablename','rowkey01' 0 row(s) in 0.0090 seconds
- 1
- 2
![](http://static.blog.csdn.net/images/save_snippets.png)
- 1
- 2
- 12.更新一条数据
hbase(main):032:0> put 'tablename','rowkey02','cf1:addr','shanghai'0 row(s) in 0.0040 seconds
- 1
- 2
- 3
![](http://static.blog.csdn.net/images/save_snippets.png)
- 1
- 2
- 3
- 13.是否enable或者disable
hbase(main):034:0> is_enabled 'tablename'true 0 row(s) in 0.0070 secondshbase(main):035:0> is_disabled 'tablename'false 0 row(s) in 0.0050 seconds
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
![](http://static.blog.csdn.net/images/save_snippets.png)
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 14.查看表是否存在
hbase(main):036:0> exists 'tablename'Table tablename does exist 0 row(s) in 0.0050 seconds
- 1
- 2
- 3
- 4
![](http://static.blog.csdn.net/images/save_snippets.png)
- 1
- 2
- 3
- 4
- 15.服务器状态
hbase(main):037:0> status1 servers, 0 dead, 5.0000 average load
- 1
- 2
- 3
![](http://static.blog.csdn.net/images/save_snippets.png)
- 1
- 2
- 3
- 16.hbase版本
hbase(main):039:0> version1.0.3, rf1e1312f9790a7c40f6a4b5a1bab2ea1dd559890, Tue Jan 19 19:26:53 PST 2016
- 1
- 2
- 3
![](http://static.blog.csdn.net/images/save_snippets.png)
- 1
- 2
- 3
- 17.删除一个列族
hbase(main):040:0> disable 'tablename'0 row(s) in 1.2310 secondshbase(main):041:0> alter 'tablename',{NAME => 'cf1',METHOD => 'delete'} Updating all regions with the new schema...1/1 regions updated.Done.0 row(s) in 1.1460 secondshbase(main):042:0> enable 'tablename'0 row(s) in 0.1550 seconds
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
![](http://static.blog.csdn.net/images/save_snippets.png)
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 18.获得表的描述
hbase(main):044:0> describe 'tablename'Table tablename is ENABLED tablename COLUMN FAMILIES DESCRIPTION {NAME => 'cf2', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'} 1 row(s) in 0.0150 secondshbase(main):045:0> desc 'tablename'Table tablename is ENABLED tablename COLUMN FAMILIES DESCRIPTION {NAME => 'cf2', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'} 1 row(s) in 0.0240 seconds
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
![](http://static.blog.csdn.net/images/save_snippets.png)
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 19.清空整个表
hbase(main):046:0> truncate 'tablename'Truncating 'tablename' table (it may take a while): - Disabling table... - Truncating table...0 row(s) in 1.3600 seconds
- 1
- 2
- 3
- 4
- 5
- 6
![](http://static.blog.csdn.net/images/save_snippets.png)
- 1
- 2
- 3
- 4
- 5
- 6
- 20.删除整个表
hbase(main):048:0> disable 'tablename'0 row(s) in 1.1720 secondshbase(main):049:0> drop 'tablename'0 row(s) in 0.1720 secondshbase(main):050:0> listTABLE stu t1 2 row(s) in 0.0100 seconds=> ["stu", "t1"]
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
![](http://static.blog.csdn.net/images/save_snippets.png)
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
下次更新filter操作,未完待续。。。。
- 顶
- 1
- 踩
- 0
- 上一篇白话hadoop yarn的调度过程以mapreduce程序为例
- 下一篇Hbase基于java API的增删改查(旧API)
相关文章推荐
- • Hbase入门API操作和 shell操作
- • HBase Shell 常用操作
- • HBase客户端操作
- • HBase学习笔记 --- 基本shell操作
- • HBase Shell工具操作HBase
- • hbase的shell操作
- • HBase Shell 基本操作
- • hbase shell常用操作指令
- • Hbase 基本shell操作命令
- • HBase shell基础和常用命令详解
阅读全文
0 0
- Hbase的常用shell操作
- hbase的常用shell操作
- Hbase的常用shell操作
- hbase shell 常用操作
- HBase Shell 常用操作
- HBase Shell 常用操作
- HBase Shell 常用操作
- hbase shell 的基本常用操作
- hbase shell常用操作指令
- hbase的shell操作
- HBase的Shell操作
- hbase的shell操作
- Hbase的shell操作
- Hbase的shell操作
- hbase的常用操作
- Hbase常用的shell命令
- 3.Hbase常用Shell操作示例
- HBASE的SHELL命令操作
- Android 不通过USB数据线调试
- hadoop-2.8编译以及集群安装
- linux防火墙基础及iptables数据流
- php 根据标签的属性值来爬取内容的正则表达式
- 【HDU 6040 Hints of sd0061】 思维 & STL
- Hbase的常用shell操作
- js进度条
- 【2017多校】HDU6058 Kanade's sum 【链表】
- Best_Time_to_Buy_and_Sell_Stock_II
- 简单说明Oracle数据库中对死锁的查询及解决方法
- 环境培训资源链接
- 钓鱼网站+邮件诈骗 实例分析
- JSPs only permit GET POST or HEAD的解决方案(REST风格)
- 排序算法---选择排序