hbase经常使用命令


/usr/local/cloud/hbase/bin/hbase shell
用shell来连接hbase

exit
退出hbase shell

version
查看hbase版本号

hbase(main):045:0> is_enabled 't1'

true                                                                                                                                                                            

0 row(s) in 0.0020 seconds
測试表t1是否有效

hbase(main):046:0> is_disabled 't1'

false                                                                                                                                                                           

0 row(s) in 0.0010 seconds
測试表t1是否无效

hbase(main):044:0> exists 't1'

Table t1 does exist                                                                                                                                                             

0 row(s) in 0.0270 seconds
測试表t1是否存在

scan 'full_user_profile', {LIMIT=>1}
输出数据表full_user_profile中的1个RowKey

list
列出全部数据表

describe 'full_user_profile'
列出full_user_profile数据表的结构

hbase(main):003:0> disable 'score'

0 row(s) in 2.1080 seconds
使数据表score无效



hbase(main):004:0> drop 'score'

0 row(s) in 10.6740 seconds
删除数据表score(注意在删除表之前要使表无效)




hbase shell实践操作1


hbase(main):013:0> create 'score', 'name', 'course'

0 row(s) in 5.1050 seconds
创建数据表score。当中name是Row Key,course是列族



hbase(main):014:0> put 'score', 'xiaowen', 'course:China', '95'

0 row(s) in 33.4270 seconds
在列族course下创建列China,值为95



hbase(main):015:0> put 'score', 'xiaowen', 'course:Math', '99'

0 row(s) in 0.0130 seconds
在列族course下创建列Math,值为99

hbase(main):016:0> put 'score', 'xiaowen', 'course:English', '98'

0 row(s) in 0.0040 seconds

在列族course下创建列English,值为98

hbase(main):017:0> scan 'score'

ROW                                           COLUMN+CELL                                                                                                                       

xiaowen                                      column=course:China, timestamp=1400141524101, value=95                                                                            

xiaowen                                      column=course:English, timestamp=1400141591123, value=98                                                                          

xiaowen                                      column=course:Math, timestamp=1400141579107, value=99                                                                             

1 row(s) in 0.0250 seconds
查看score整张表的数据

hbase(main):018:0> get 'score', 'xiaowen'

COLUMN                                        CELL                                                                                                                              

course:China                                 timestamp=1400141524101, value=95                                                                                                 

course:English                               timestamp=1400141591123, value=98                                                                                                 

course:Math                                  timestamp=1400141579107, value=99                                                                                                 

3 row(s) in 0.0110 seconds
查看score表的xiaowen行数据

hbase(main):019:0> get 'score', 'xiaowen', 'course:Math'

COLUMN                                        CELL                                                                                                                              

course:Math                                  timestamp=1400141579107, value=99                                                                                                 

1 row(s) in 0.0070 seconds
查看score表的xiaowen行,course列族上的Math列的数据

hbase(main):008:0> scan 'score'

ROW                                           COLUMN+CELL                                                                                                                       

xiaowen                                      column=course:China, timestamp=1400141524101, value=95                                                                            

xiaowen                                      column=course:English, timestamp=1400141591123, value=98                                                                          

xiaowen                                      column=course:Math, timestamp=1400141579107, value=99                                                                             

xiaoye                                       column=course:China, timestamp=1400143888087, value=85                                                                            

xiaoye                                       column=course:English, timestamp=1400143921395, value=85                                                                          

xiaoye                                       column=course:Math, timestamp=1400143907407, value=85                                                                             

2 row(s) in 0.0240 seconds
查看score表的全部值

hbase(main):013:0> scan 'score', {COLUMNS=>'course'}

ROW                                           COLUMN+CELL                                                                                                                       

xiaowen                                      column=course:China, timestamp=1400141524101, value=95                                                                            

xiaowen                                      column=course:English, timestamp=1400141591123, value=98                                                                          

xiaowen                                      column=course:Math, timestamp=1400141579107, value=99                                                                             

xiaoye                                       column=course:China, timestamp=1400143888087, value=85                                                                            

xiaoye                                       column=course:English, timestamp=1400143921395, value=85                                                                          

xiaoye                                       column=course:Math, timestamp=1400143907407, value=85                                                                             

2 row(s) in 0.0230 seconds
查看score表的course列的全部值



hbase(main):014:0> scan 'score', {COLUMNS=>'course:Math'}

ROW                                           COLUMN+CELL                                                                                                                       

xiaowen                                      column=course:Math, timestamp=1400141579107, value=99                                                                             

xiaoye                                       column=course:Math, timestamp=1400143907407, value=85                                                                             

2 row(s) in 0.0270 seconds
查看score表course:Math列的全部值

hbase(main):021:0> count 'score'

2 row(s) in 0.1880 seconds
统计score表有多少行



hbase shell实践操作2:test表的实践



hbase(main):022:0> create 'test', 'c1', 'c2'

0 row(s) in 1.1260 seconds



hbase(main):023:0> put 'test', 'r1', 'c1:1', 'value1-1/1'

0 row(s) in 0.0360 seconds



hbase(main):024:0> put 'test', 'r1', 'c1:2', 'value1-1/2'

0 row(s) in 0.0210 seconds



hbase(main):025:0> put 'test', 'r1', 'c1:3', 'value1-1/3'

0 row(s) in 0.0170 seconds



hbase(main):026:0> put 'test', 'r1', 'c2:1', 'value1-2/1'

0 row(s) in 0.0100 seconds



hbase(main):027:0> put 'test', 'r1', 'c2:2', 'value1-2/2'

0 row(s) in 0.0060 seconds



hbase(main):028:0> put 'test', 'r2', 'c1:1', 'value2-1/1'

0 row(s) in 0.0110 seconds



hbase(main):029:0> put 'test', 'r2', 'c2:1', 'value2-2/1'

0 row(s) in 0.0080 seconds

hbase(main):030:0> scan 'test'

ROW                                           COLUMN+CELL                                                                                                                        

r1                                           column=c1:1, timestamp=1400152716678, value=value1-1/1                                                                             

r1                                           column=c1:2, timestamp=1400152749600, value=value1-1/2                                                                             

r1                                           column=c1:3, timestamp=1400152770555, value=value1-1/3                                                                             

r1                                           column=c2:1, timestamp=1400152793839, value=value1-2/1                                                                             

r1                                           column=c2:2, timestamp=1400152811436, value=value1-2/2                                                                             

r2                                           column=c1:1, timestamp=1400152843148, value=value2-1/1                                                                             

r2                                           column=c2:1, timestamp=1400152858073, value=value2-2/1                                                                             

2 row(s) in 0.0490 seconds

hbase(main):031:0> describe 'test'

DESCRIPTION                                                                                                        ENABLED                                                       

{NAME => 'test', FAMILIES => [{NAME => 'c1', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'NONE', REPLICATION_SC true                                                          

OPE => '0', VERSIONS => '3', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => '2147483647', KEEP_DELETED_CELLS                                                                

=> 'false', BLOCKSIZE => '65536', IN_MEMORY => 'false', ENCODE_ON_DISK => 'true', BLOCKCACHE => 'true'}, {NAME =>                                                               

  'c2', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSI                                                               

ON => 'NONE', MIN_VERSIONS => '0', TTL => '2147483647', KEEP_DELETED_CELLS => 'false', BLOCKSIZE => '65536', IN_M                                                               

EMORY => 'false', ENCODE_ON_DISK => 'true', BLOCKCACHE => 'true'}]}                                                                                                             

1 row(s) in 0.2560 seconds

从describe命令可见test表有两个列族

hbase shell经常使用命令的更多相关文章

  1. hbase基本概念和hbase shell经常使用命令使用方法

    HBase是一个分布式的.面向列的开源数据库,源于google的一篇论文<bigtable:一个结构化数据的分布式存储系统>.HBase是Google Bigtable的开源实现,它利用H ...

  2. HBase shell的常用命令(CRUD)

    @来源是传智播客hadoop的视频教程,觉得入门不错,就copy过来了 一.启动HBase: sudo -i  cd /home/cx/itcast/hbase-1.2.6/bin  ./start- ...

  3. Hbase记录-Hbase shell使用

    HBase Shell HBase包含可以与HBase进行通信的Shell. HBase使用Hadoop文件系统来存储数据.它拥有一个主服务器和区域服务器.数据存储将在区域(表)的形式.这些区域被分割 ...

  4. HBase Shell 常用命令及例子

    下面我们看看HBase Shell的一些基本操作命令,我列出了几个常用的HBase Shell命令,如下: 名称 命令表达式 创建表 create '表名称', '列名称1','列名称2','列名称N ...

  5. hbase shell基础和常用命令详解(转)

    HBase shell的基本用法 hbase提供了一个shell的终端给用户交互.使用命令hbase shell进入命令界面.通过执行 help可以看到命令的帮助信息. 以网上的一个学生成绩表的例子来 ...

  6. hbase shell 常用命令

    进入hbase shell console$HBASE_HOME/bin/hbase shell如果有kerberos认证,需要事先使用相应的keytab进行一下认证(使用kinit命令),认证成功之 ...

  7. (转)Hbase shell 常用命令(1)

    Hbase shell 常用命令(1) link:http://blog.csdn.net/scutshuxue/article/details/6988348 下面我们看看HBase Shell的一 ...

  8. hbase基本概念和hbase shell常用命令用法

    1. 简介 HBase是一个分布式的.面向列的开源数据库,源于google的一篇论文<bigtable:一个结构化数据的分布式存储系统>.HBase是Google Bigtable的开源实 ...

  9. Hbase Shell命令

    1 启动HBase shell 2 HBase shell 命令 3 我们将以“一个学生成绩表”的例子来详细介绍常用的 HBase 命令及其使用方法. 这里 grad 对于表来说是一个列,course ...

随机推荐

  1. CAD参数绘制文字(com接口)

    在CAD设计时,需要绘制文字,用户可以设置设置绘制文字的高度等属性. 主要用到函数说明: _DMxDrawX::DrawText 绘制一个单行文字.详细说明如下: 参数 说明 DOUBLE dPosX ...

  2. SqlServer数据库练习20190211

    一条update语句,修改多个条件 update orderdt_jimmy set qty = (case else qty end); 好了,就这样

  3. github 添加完sshkey之后仍然需要输入密码

    1.在家目录下创建.netrc文件,内容如下 machine github.com login username password password window下创建:在用户文件夹如C:\Users ...

  4. 阿里云 Django部署参考

    Linux下安装Python3和django并配置mysql作为django默认服务器 CentOS7.3安装Python3.6 yum except KeyboardInterrupt, e: 错误 ...

  5. sql分组和连接

    SELECT mr.member_id, mr.username, GROUP_CONCAT(DISTINCT jb.company,jb.start_time,jb.end_time)company ...

  6. [Python3网络爬虫开发实战] 7.2-Splash的使用

    Splash是一个JavaScript渲染服务,是一个带有HTTP API的轻量级浏览器,同时它对接了Python中的Twisted和QT库.利用它,我们同样可以实现动态渲染页面的抓取. 1. 功能介 ...

  7. 黑马毕向东Java基础知识总结

    Java基础知识总结(超级经典) 转自:百度文库 黑马毕向东JAVA基础总结笔记    侵删! 写代码: 1,明确需求.我要做什么? 2,分析思路.我要怎么做?1,2,3. 3,确定步骤.每一个思路部 ...

  8. 2014-4-5安装python以及基础知识

    1.下载安装 从python官网下载python2.7.6 https://www.python.org/download/releases/2.7.6 建议用迅雷下载 会比较快 2.交互式解释器 运 ...

  9. Spring框架中 配置c3p0连接池

    开发准备: 1.导入jar包: ioc基本jar jdbcTemplate基本jar c3p0基本jar 别忘了mysql数据库驱动jar 原始程序代码:不使用配置文件方式(IOC)生成访问数据库对象 ...

  10. HDU 1800 hash 找出现最多次数的字符串的次数

    乘法hash: 这类hash函数利用了乘法的不相关性 int Hash(char *str){    int seed = 131 , value=0;    while(*str != '\0'){ ...