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. Java XML SAX 解析注意

    版权声明: 欢迎转载,但请保留文章原始出处 作者:GavinCT 出处:http://www.cnblogs.com/ct2011/p/4002738.html 什么时候可以把解析值赋给对象 一般从网 ...

  2. JQuery 引用方式

    # head里面 <script src="jquery.min.js"></script> <script src="common.js& ...

  3. python中的字符串编码问题——4.unicode编解码(以实际工作中遇到的韩文编码为例)

    韩文unicode编解码  问题是这样,工作中遇到有韩文数据出现乱码,说是unicode码. 类似这样: id name 323 52186863 149 63637538 314 65516863 ...

  4. alwayson监控

    最近大体自己写了点alwayson相关的监控,是通过存储过程的方法,做个笔记如下: --alwayson启用状态 declare @isenabled sql_variant SELECT @isen ...

  5. JS弹出div简单样式

    <div id="dialog" style="display:none;z-index:9999;position: absolute;border:1px so ...

  6. 用Spider引擎解决数据库垂直和水平拆分的问题

    作者介绍 张秀云,网名飞鸿无痕,现任职于腾讯,负责腾讯金融数据库的运维和优化工作.2007年开始从事运维方面的工作,经历过网络管理员.Linux运维工程师.DBA.分布式存储运维等多个IT职位.对Li ...

  7. UNIX高级环境编程(9)进程控制(Process Control)- fork,vfork,僵尸进程,wait和waitpid

    本章包含内容有: 创建新进程 程序执行(program execution) 进程终止(process termination) 进程的各种ID   1 进程标识符(Process Identifie ...

  8. 我在德国做SAP CRM One Order redesign工作的心得

    时间过得很快,今天是我到德国工作的第四周,刚好一个月.Prototype的框架已经搭起来了,现在Order能够在新的框架下正常读写,能跑一些简单的scenario,这些scenario对于end us ...

  9. Hibernate核心对象

    1.Configuration Configuration 类负责管理Hibernate的配置信息.它包括如下内容: Hibernate运行的底层信息:数据库的URL.用户名.密码.JDBC驱动类,数 ...

  10. OpenStack虚拟机快照和增量备份实现

    1 快照的概念一般对快照的理解就是能够将系统还原到某个瞬间,这就是快照的作用.快照针对要保存的数据分为内存快照和磁盘快照,内存快照就是保存当前内存的数据,磁盘快照就是保存硬盘的数据.快照针对保存方式又 ...