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. Storm默认配置 default.yaml

    default.yaml文件所在位置:apache-storm-0.9.4.tar.gz/apache-storm-0.9.4/lib/storm-core-0.94.jar/default.yaml ...

  2. 如何在微软Windows平台上打造出你的Linux开发环境(转载)

    如何在微软Windows平台上打造出你的Linux开发环境 投递人 itwriter 发布于 2013-12-10 11:18 评论(1) 有348人阅读  原文链接  [收藏]  « » 英文原文: ...

  3. 【转】虚拟机安装Ubuntu的上网设置(有线网络和无线网络)

    虚拟机下ubuntu共享方式上网: 一. 有线网络 在有线网络的条件下,vmware的安装非常简单,上网方式几乎不用怎么设置(默认NAT模式)    如果默认情况下不能上网,则按以下步骤尝试: *** ...

  4. python是如何找到对应的package的?

    我们在写python代码或者阅读别人的代码时,可能会碰到对应module无法找到的问题,这时如何解决呢?我们如果对python解释器如何查找对应的module有比较深刻的理解,那么我们就可以轻松解决相 ...

  5. 机器学习vs深度学习及其知识点

    人工智能如火如荼,可以遇见这将会是近10年最大的创新机会.那么到底什么是人工智能? 机器学习和神经网络什么关系? 卷积神经网络中的矩阵内积是怎么计算的?

  6. VC++下使用ADO操作数据库

    VC++下使用ADO操作数据库主要要用到 _ConnectionPtr,_CommandPtr,_RecordsetPtr三个ADO对象指针,我查找了相关资料,发现网上源码很多,但是都相对凌乱,于是自 ...

  7. C# 输入一个整数,求质因数

    质数,质因数 应该都了解,在这里不过多解释,直接上代码: List<int> results = new List<int>(); int number = Int32.Par ...

  8. [控件] LineAnimationView

    LineAnimationView 效果 说明 水平循环无间隔播放动画效果,用于loading的界面 源码 https://github.com/YouXianMing/UI-Component-Co ...

  9. 可以简易设置文字内边距的EdgeInsetsLabel

    可以简易设置文字内边距的EdgeInsetsLabel 最终效果: 源码: EdgeInsetsLabel.h 与 EdgeInsetsLabel.m // // EdgeInsetsLabel.h ...

  10. PHP防SQL注入和XSS攻击

    摘要: 就是通过把SQL命令插入到Web表单提交或输入域名或页面请求的查询字符串,最终达到欺骗服务器执行恶意的SQL命令.在用户名输入框中输入:' or 1=1#,密码随便输入,这时候的合成后的SQL ...