`

HBase Shell命令学习

阅读更多
在hbase shell状态下,使用命令help,会显示hbase 所有的命令
hbase(main):015:0> help
NameError: undefined local variable or method `he' for #<Object:0x1900f17>

hbase(main):016:0> help
HBase Shell, version 0.92.1, r1298924, Fri Mar  9 16:58:34 UTC 2012
Type 'help "COMMAND"', (e.g. 'help "get"' -- the quotes are necessary) for help on a specific command.
Commands are grouped. Type 'help "COMMAND_GROUP"', (e.g. 'help "general"') for help on a command group.

COMMAND GROUPS:
  Group name: general
  Commands: status, version

  Group name: ddl
  Commands: alter, alter_async, alter_status, create, describe, disable, disable_all, drop, drop_all, enable, enable_all, exists, is_disabled, is_enabled, list, show_filters

  Group name: dml
  Commands: count, delete, deleteall, get, get_counter, incr, put, scan, truncate

  Group name: tools
  Commands: assign, balance_switch, balancer, close_region, compact, flush, hlog_roll, major_compact, move, split, unassign, zk_dump

  Group name: replication
  Commands: add_peer, disable_peer, enable_peer, list_peers, remove_peer, start_replication, stop_replication

  Group name: security
  Commands: grant, revoke, user_permission

SHELL USAGE:
Quote all names in HBase Shell such as table and column names.  Commas delimit
command parameters.  Type <RETURN> after entering a command to run it.
Dictionaries of configuration used in the creation and alteration of tables are
Ruby Hashes. They look like this:

  {'key1' => 'value1', 'key2' => 'value2', ...}

and are opened and closed with curley-braces.  Key/values are delimited by the
'=>' character combination.  Usually keys are predefined constants such as
NAME, VERSIONS, COMPRESSION, etc.  Constants do not need to be quoted.  Type
'Object.constants' to see a (messy) list of all constants in the environment.

If you are using binary keys or values and need to enter them in the shell, use
double-quote'd hexadecimal representation. For example:

  hbase> get 't1', "key\x03\x3f\xcd"
  hbase> get 't1', "key\003\023\011"
  hbase> put 't1', "test\xef\xff", 'f1:', "\x01\x33\x40"

The HBase shell is the (J)Ruby IRB with the above HBase-specific commands added.
For more on the HBase Shell, see http://hbase.apache.org/docs/current/book.html

挨个看看
general:
status 查看hbase状态
hbase(main):017:0> status
1 servers, 0 dead, 4.0000 average load

version 查看版本
0.92.1, r1298924, Fri Mar  9 16:58:34 UTC 2012 

看一下hbase常用的操作命令有:
create,describe,disable,drop,list,scan,put,get,delete,deleteall,count,status
创建表
create 'user','username','mobile'
查看所有的表:
hbase(main):001:0> list
TABLE                                                                                                                 
test                                         
test1     
user 
查看表结构

hbase(main):003:0> describe 'user'
DESCRIPTION                                                                                     ENABLED                                            
 {NAME => 'user', FAMILIES => [{NAME => 'mobile', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => ' true                                               
 0', VERSIONS => '3', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => '2147483647', BLOCKSIZ                                                    
 E => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}, {NAME => 'name', BLOOMFILTER => 'NO                                                    
 NE', REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TT                                                    
 L => '2147483647', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}]} 
删除一个列族,alter,disable,enable
hbase(main):003:0>alter 'user',{NAME=>'mobile',METHOD=>'delete'} 
drop一个表
Drop the named table. Table must first be disabled. If table has. more than one region, run a major compaction on .META.:
drop之前必须先disabled表
hbase(main):036:0> disable   'test'
0 row(s) in 2.2000 seconds

hbase(main):037:0> drop 'test'
0 row(s) in 1.8130 seconds

hbase(main):038:0> list
TABLE                                                                                                                 
persion                                                              
test1                                                         
user 
查看表是否存在
hbase(main):039:0> exists 'test'
Table test does not exist  

睡觉。 
==续
version就是修改数据的版本,比如你可以查你修改之前的值
查看此列的多个版本
hbase(main):005:0> get 'blog','1',{COLUMN=>'author:name',VERSIONS=>2}
COLUMN                         CELL                                                                                 
 author:name                   timestamp=1336903227226, value=zhangkai                                              
 author:name                   timestamp=1336903136510, value=zhnagkai                                              
2 row(s) in 0.0350 seconds
如果只想看旧版本的值,需要借助TIMESTAMP
hbase(main):006:0> get 'blog','1',{COLUMN=>'author:name',TIMESTAMP=>1336903136510}
COLUMN                         CELL                                                                                 
 author:name                   timestamp=1336903136510, value=zhnagkai                                              
1 row(s) in 0.0270 seconds
删除一列
delete 'blog','1','author:name'
删除RowKey的所有column
deleteall 'blog','1'






参考:http://wiki.apache.org/hadoop/Hbase/Shell
分享到:
评论

相关推荐

    快速学习-HBase Shell操作

    第3章 HBase Shell操作 3.1 基本操作 进入HBase客户端命令行 [atguigu@hadoop102 hbase]$ bin/hbase shell 查看帮助命令 hbase(main):001:0&gt; help 查看当前数据库中有哪些表 hbase(main):002:0&gt; list 3.2 表的...

    大数据技术原理及应用课实验3 熟悉常用的HBase操作 林子雨实验

    2. 熟练使用HBase操作常用的Shell命令; 3. 熟悉HBase操作常用的Java API。 二、实验平台 1. 操作系统:Linux(建议Ubuntu16.04或Ubuntu18.04); 2. Hadoop版本:3.1.3; 3. HBase版本:2.2.2; 4. JDK版本:1.8; ...

    HBase完整学习笔记

    - HBase介绍 - HBase内部组成 - 安装运行HBase (单击、伪分布、完全分布式) - Shell 命令操作 - HBase 客户端 API - HBase 客户端API:管理功能 - 日期操作

    HBase.docx

    3.hbase的shell脚本 13 4.对namespace的操作 13 5.查看namespace 13 5.1 查看namespace下面有什么table 13 6.创建namespace 14 7.描述namespace 14 8.删除namespace 15 四:对表的操作 15 1.查看表 15 2.新建表 16 3...

    Hbase+Spring boot实战分布式文件存储

    3-1 HBase写流程 3-2 HBase读流程 3-3 HBase模块协作 3-4 HBase实战:Shell命令实战 3-5 HBase实 战:Java Api实现HBase连接类 3-6 HBase实战:Java Api实现HBase操作类 3-7 HBase实战:用过滤器筛选数据 3-8 HBase...

    大数据学习路线 大数据技术栈思维导图 大数据常用软件安装指南

    HDFS 常用 Shell 命令 HDFS Java API 的使用 基于 Zookeeper 搭建 Hadoop 高可用集群 Hive Hive 简介及核心概念 Linux 环境下 Hive 的安装部署 Hive CLI 和 Beeline 命令行的基本使用 Hive 常用 DDL 操作 Hive 分区...

    Hadoop+Hive+Spark+Kafka+Zookeeper+Flume+Sqoop+Azkaban+Scala

    常用 Shell 命令 Java API 的使用 基于 Zookeeper 搭建 Hadoop 高可用集群 二、Hive 简介及核心概念 Linux 环境下 Hive 的安装部署 CLI 和 Beeline 命令行的基本使用 常用 DDL 操作 分区表和分桶表 视图和索引 常用 ...

    实验二:熟悉常用的HDFS操作

    (2)熟练使用HDFS操作常用的 Shell命令。(3)熟悉HDFS操作常用的Java API。 A.2.2 实验平台 (1)操作系统:Linux(建议Ubuntu 16.04)。(2) Hadoop版本:2.7.1。 (3)JDK版本:1.7或以上版本。(4) Java IDE:Eclipse。

    大数据工程师学习计划.pdf

    ⼤数据⼯程师学习计划 申明:本⽂旨在为普通程序员(Java程序员最佳)提供⼀个⼊门级别的⼤数据技术学习路径,不适⽤于⼤数据⼯程师的进阶学习,也不适⽤ 于零编程基础的同学。 前⾔ ⼀、背景介绍 本⼈⽬前是⼀名⼤...

    Java及大数据学习路线.pdf

    命令解析器Shell 2.3Hadoop⽣态体系 ⼤数据存储框架Hadoop 分布式服务管理框架zookeeper hadoop⾼可⽤HA 数据仓库hive 数据查询框架impala+kudu+clouderManager ⽇志采集传输框架flume/idea 分布式发布-订阅消息系统...

    2017最新大数据架构师精英课程

    本资源为大数据基础到中高级教学资源,适合稍微有点大数据或者java基础的人群学习,资源过大,上传乃是下载链接,不多说,上目录: 1_java基础2 l3 a2 a$ t7 J2 b+ `- p 2_java引入ide-eclipse 3_java基础知识-循环...

    大数据学习笔记.pdf

    4.1 Spark Shell ................................................................................................................ 13 4.2 RDD Transformations ...............................................

    autoinstallhadoop:自动安装JDK,Maven,Ant,Maven,Hadoop脚本

    autoinstallhadoop 自动安装JDK,Maven,Ant,Maven,Hadoop脚本 脚本开发者:三劫散仙 ...本脚本能够快速在Linux上安装JAVA环境,并部署hadoop,其中关于hadoop,hbase和Zookeeper的配置 分别在压缩包内的

    BigData::gem_stone::fire:大数据学习笔记

    Hbase是数据库,Hive是数据仓库 MapReduce执行过程 数据类型与格式 使用hive(表描述在hive数据库的TBLS表中,表中的细分在COLUMNS_V2表中,表的id在CDS表中,存储HDFS上的路径在SDS表中) Linux文件/目录管理类命令...

    大数据架构师的岗位职责.docx

    3、熟悉Linux,熟练使用Shell或Python,进行脚本编写; 4、对数据结构和数据统计分析算法有较为深刻理解; 5、掌握至少一种主流关系数据库开发技术:Oracle、SQL Server、MySQL等; 6、掌握实时流计算技术,有Spark、...

    DataX Web分布式数据同步工具-其他

    DataX Web是在DataX之上开发的分布式数据同步工具,提供简单易用的操作界面,降低用户使用DataX的学习成本,缩短任务配置时间,避免配置过程中出错。用户可通过页面选择数据源即可创建数据同步任务,RDBMS数据源可...

Global site tag (gtag.js) - Google Analytics