HBase 为用户提供了一个非常方便的使用方式, 我们称之为“HBase Shell”。

HBase Shell 提供了大多数的 HBase 命令, 通过 HBase Shell 用户可以方便地创建、删除及修改表, 还可以向表中添加数据、列出表中的相关信息等。

用HBase shell进行表操作

1. 创建student表,表结构包含info和course列族,显示表结构。

create ‘student’,‘info’,‘course’

desc ‘student’

2. 修改表结构,course列族返回最大版本数为3,显示表结构。

alter ‘student’,{NAME=>‘course’,VERSIONS=>3}

describe ‘student’

3. 输入数据,要求至少包括以下列

(具体数据自定,course列族要输入部分小于60分的数据)

info列族:name、age、sex、dept

course列族:english、math、physics

put ‘student’,‘001’,‘info:name’,‘liu’,3

put ‘student’,‘001’,‘info:age’,‘18’,11

put ‘student’,‘001’,‘info:sex’,‘nan’,15

put ‘student’,‘001’,‘info:dept’,‘JAVA’,10

put ‘student’,‘002’,‘info:name’,‘ma’,8

put ‘student’,‘002’,‘info:age’,‘19’,2

put ‘student’,‘002’,‘info:sex’,‘nan’,5

put ‘student’,‘002’,‘info:dept’,‘WEB’,10

put ‘student’,‘003’,‘info:name’,‘zhang’,6

put ‘student’,‘003’,‘info:age’,‘18’,4

put ‘student’,‘003’,‘info:sex’,‘nv’,10

put ‘student’,‘003’,‘info:dept’,‘JS’,9

put ‘student’,‘001’,‘course:english’,‘69’,13

put ‘student’,‘001’,‘course:math’,‘92’,16

put ‘student’,‘001’,‘course:physics’,‘46’,20

put ‘student’,‘002’,‘course:english’,‘89’,13

put ‘student’,‘002’,‘course:math’,‘64’,16

put ‘student’,‘002’,‘course:physics’,‘59’,17

put ‘student’,‘003’,‘course:english’,‘70’,13

put ‘student’,‘003’,‘course:math’,‘35’,16

put ‘student’,‘003’,‘course:physics’,‘72’,21

4. 更新数据,将course列族中小于60的数据更新为60。

put  ‘student’,‘001’,‘ course:physics’,‘60’,20

put  ‘student’,‘002’,‘ course:physics’,‘60’,17

5. 使用get进行数据查询。

get ‘student’,‘001’

6. 使用scan进行查询。

scan ‘student’

7. 使用列族过滤器进行查询。

scan‘student’,FILTER=>“FamilyFilter(=,‘substring:info’)”

8. 创建student表的快照stu_snap,显示快照列表。

snapshot ‘student’,‘stu_snap’

list_snapshots

9. 通过快照stu_snap生成新表stu_info,并显示stu_info表结构。

clone_sanpshot ‘stu_snap’,‘stu_info’

desc ‘stu_info’

10. 删除快照stu_snap,删除student表。

disable ‘student’

drop ‘student’

delete_snapshot ‘stu_snap’

关于HBase Shell命令基本操作示例的更多相关文章

  1. HBase shell 命令。

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

  2. Hbase Shell命令

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

  3. HBase shell 命令介绍

    HBase shell是HBase的一套命令行工具,类似传统数据中的sql概念,可以使用shell命令来查询HBase中数据的详细情况.安装完HBase之后,如果配置了HBase的环境变量,只要在sh ...

  4. HBASE SHELL 命令使用

    HBASE SHELL命令的使用 在hbase shell客户端有许多的操作命令,今天回顾并且总结一二,希望和广大读者共同进步,并且悉心聆听你们的意见.在此的hbase版本是:HBase 1.2.0- ...

  5. 第六章 hbase shell 命令

    hbase shell命令                             描述  alter 修改列族(Column Family)模式 count 统计表中行的数量 create 创建表 ...

  6. 使用HBase Shell命令

    使用HBase Shell命令 或 使用HBase Java API完成: 列出HBase所有的表的相关信息,例如表名: 在终端打印出指定的表的所有记录数据: 向已经创建好的表添加和删除指定的列族或列 ...

  7. Hbase Shell命令详解+API操作

    HBase Shell 操作 3.1 基本操作1.进入 HBase 客户端命令行,在hbase-2.1.3目录下 bin/hbase shell 2.查看帮助命令 hbase(main):001:0& ...

  8. 入门大数据---HBase Shell命令操作

    学习方法 可以参考官方文档的简单示例来 点击查看 可以直接在控制台使用help命令查看 例如直接使用help命令: 从上图可以看到,表结构的操作,表数据的操作都展示了.接下来我们可以针对具体的命令使用 ...

  9. Hbase记录-shell脚本嵌入hbase shell命令

    第一种方式:hbase shell test.txt test.txt:list 第二种方式:<<EOF重定向输入 我们经常在shell脚本程序中用<<EOF重定向输入,将我们 ...

随机推荐

  1. 对layoutInflater的理解

    参考该博客:http://www.cnblogs.com/top5/archive/2012/05/04/2482328.html LayoutInflater是一个抽象类,通过调用其实例方法infl ...

  2. mac系统使用介绍

    点击左上角苹果-->关于本机 Dock-->偏好设置 推荐按装mac系统:OS X V10.8(山狮) Finder-->应用程序(安装程序)<==>我的电脑 Safar ...

  3. is_palindrome 回文递归

    # coding=utf-8def is_palindrome(n,start,end): if start>end: return 1 else: return is_palindrome(n ...

  4. windows 删除删除不掉的文件

    DEL /F /A /Q \\?\%1RD /S /Q \\?\%1 windows下删除删除不掉的文件: 1.打开记事本,把上面的命令复制进去 2.保存,后缀名改为.bat,ok 3.把想要删除的文 ...

  5. 【AOP】spring 的AOP编程报错:[Xlint:invalidAbsoluteTypeName]error

    AOP来发过程中,报错如下: warning no match for this type name: net.shopxx.wx.institution.controller [Xlint:inva ...

  6. JVM知识(二):类加载器原理

    我们知道我们编写的java代码,会经过编译器编译成字节码(class文件),再把字节码文件装载到JVM中,最后映射到各个内存区域中,我们的程序就可以在内存中运行了.那么问题来了,这些字节码文件是怎么装 ...

  7. 使用AKLocationManager定位

    使用AKLocationManager定位 https://github.com/ideaismobile/AKLocationManager 以下是使用情况: 是不是很简单呢,我们可以将它的步骤进一 ...

  8. 如何添加设备UDID到开发者中心

    如何添加设备UDID到开发者中心 1. 登录开发者中心 2. 选择证书那一项 3. 选择Devices 4. 点选+按钮 5. 填上设备的UUID以及设备名字然后添加上 大功告成:) 附录: 如何获取 ...

  9. hibernate设置了not-null 为什么无效?

    因为设错地方了! 错误--写在了property标签里 <property name="password" type="string" length=&q ...

  10. EntityFramework Core2.0 多对多关系配置

    ​ 在EF6.0 中,多对多关系配置时,系统会自动生成第三张表,来将两张有互相约束关系的表联系起来,但是在EF Core2.0中,我们需要手动建立第三张表,比如说有两个模型Passage.cs和Cat ...