- 浏览: 687699 次
- 性别:
- 来自: 成都
文章分类
- 全部博客 (129)
- Java (13)
- Android (9)
- J2ee (3)
- Swt/jface (0)
- SSH (9)
- C/C++ (1)
- php (1)
- Algorithm (2)
- Apache/Nginx (12)
- Bea/Tomcat (2)
- Oracle/Mysql (10)
- Sql/derby (17)
- Unix/Linux (11)
- Hadoop (1)
- Hbase (15)
- Redis (2)
- Lucene/Solr (0)
- Httpclient (1)
- Groovy (2)
- SoftwareEng (2)
- HTML/JS/CSS (3)
- Flex (1)
- log4j (1)
- Protocol (3)
- windows (0)
- Tools (1)
- docker (1)
- k8s (1)
- Business (3)
- Others (3)
最新评论
This page describes the JRuby IRB-based HBase Shell. It replaces the SQL-like HQL, the Shell found in HBase versions 0.1.x and previous. Some discussion of new shell requirements can be found in the Shell Replacement document.
To run the shell, do
hadoop$redhat ${HBASE_HOME}/bin/hbase shell
You'll be presented with a prompt like the following:
HBase Shell; enter 'help<RETURN>' for list of supported commands. Version: 0.2.0-dev, r670701, Mon Jun 23 17:26:36 PDT 2008 hbase(main):001:0>
Type 'help' followed by a return to get a listing of commands
hbase(main):001:0> help HBASE SHELL COMMANDS: alter Alter column family schema; pass table name and a dictionary specifying new column family schema. Dictionaries are described below in the GENERAL NOTES section. Dictionary must include name of column family to alter. For example, To change or add the 'f1' column family in table 't1' from defaults to instead keep a maximum of 5 cell VERSIONS, do: hbase> alter 't1', {NAME => 'f1', VERSIONS => 5} To delete the 'f1' column family in table 't1', do: hbase> alter 't1', {NAME => 'f1', METHOD => 'delete'} You can also change table-scope attributes like MAX_FILESIZE MEMSTORE_FLUSHSIZE and READONLY. For example, to change the max size of a family to 128MB, do: hbase> alter 't1', {METHOD => 'table_att', MAX_FILESIZE => '134217728'} count Count the number of rows in a table. This operation may take a LONG time (Run '$HADOOP_HOME/bin/hadoop jar hbase.jar rowcount' to run a counting mapreduce job). Current count is shown every 1000 rows by default. Count interval may be optionally specified. Examples: hbase> count 't1' hbase> count 't1', 100000 create Create table; pass table name, a dictionary of specifications per column family, and optionally a dictionary of table configuration. Dictionaries are described below in the GENERAL NOTES section. Examples: hbase> create 't1', {NAME => 'f1', VERSIONS => 5} hbase> create 't1', {NAME => 'f1'}, {NAME => 'f2'}, {NAME => 'f3'} hbase> # The above in shorthand would be the following: hbase> create 't1', 'f1', 'f2', 'f3' hbase> create 't1', {NAME => 'f1', VERSIONS => 1, TTL => 2592000, \ BLOCKCACHE => true} describe Describe the named table: e.g. "hbase> describe 't1'" delete Put a delete cell value at specified table/row/column and optionally timestamp coordinates. Deletes must match the deleted cell's coordinates exactly. When scanning, a delete cell suppresses older versions. Takes arguments like the 'put' command described below deleteall Delete all cells in a given row; pass a table name, row, and optionally a column and timestamp disable Disable the named table: e.g. "hbase> disable 't1'" drop Drop the named table. Table must first be disabled. If table has more than one region, run a major compaction on .META.: hbase> major_compact ".META." enable Enable the named table exists Does the named table exist? e.g. "hbase> exists 't1'" exit Type "hbase> exit" to leave the HBase Shell get Get row or cell contents; pass table name, row, and optionally a dictionary of column(s), timestamp and versions. Examples: hbase> get 't1', 'r1' hbase> get 't1', 'r1', {COLUMN => 'c1'} hbase> get 't1', 'r1', {COLUMN => ['c1', 'c2', 'c3']} hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1} hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1, \ VERSIONS => 4} list List all tables in hbase put Put a cell 'value' at specified table/row/column and optionally timestamp coordinates. To put a cell value into table 't1' at row 'r1' under column 'c1' marked with the time 'ts1', do: hbase> put 't1', 'r1', 'c1', 'value', ts1 tools Listing of hbase surgery tools scan Scan a table; pass table name and optionally a dictionary of scanner specifications. Scanner specifications may include one or more of the following: LIMIT, STARTROW, STOPROW, TIMESTAMP, or COLUMNS. If no columns are specified, all columns will be scanned. To scan all members of a column family, leave the qualifier empty as in 'col_family:'. Examples: hbase> scan '.META.' hbase> scan '.META.', {COLUMNS => 'info:regioninfo'} hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, \ STARTROW => 'xyz'} For experts, there is an additional option -- CACHE_BLOCKS -- which switches block caching for the scanner on (true) or off (false). By default it is enabled. Examples: hbase> scan 't1', {COLUMNS => ['c1', 'c2'], CACHE_BLOCKS => false} status Show cluster status. Can be 'summary', 'simple', or 'detailed'. The default is 'summary'. Examples: hbase> status hbase> status 'simple' hbase> status 'summary' hbase> status 'detailed' shutdown Shut down the cluster. truncate Disables, drops and recreates the specified table. version Output this HBase version GENERAL NOTES: Quote all names in the hbase shell such as table and column names. Don't forget 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', ...} They 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. In case you are using binary keys or values and need to enter them into the shell then use double-quotes to make use of hexadecimal or octal notations, 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" Using the double-quote notation you can directly use the values output by the shell for example during a "scan" call. This HBase shell is the JRuby IRB with the above HBase-specific commands added. For more on the HBase Shell, see http://wiki.apache.org/hadoop/Hbase/Shell
Example case:
1. 创建一张student表, ColumnFamily为name.
create 'student','name'
2. 描述student表.
hbase(main):004:0> describe 'student' DESCRIPTION ENABLED {NAME => 'student', FAMILIES => [{NAME => 'name', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', COMPRESSION => true 'NONE', VERSIONS => '3', TTL => '2147483647', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}] } 1 row(s) in 0.0710 seconds hbase(main):005:0>
3. 往表student插入数据
hbase(main):017:0> put 'student','111','name:firstname','kim' 0 row(s) in 0.0380 seconds
4. 查询student, 键为111的value
hbase(main):023:0> get 'student','111' COLUMN CELL name:firstname timestamp=1338877705167, value=kim 1 row(s) in 0.0190 seconds hbase(main):024:0>
5. 全部查询
hbase(main):010:0> scan 'student' ROW COLUMN+CELL 111 column=name:firstname, timestamp=1338877705167, value=kim 1 row(s) in 0.4250 seconds hbase(main):011:0>
6. 查询
hbase(main):019:0> get 'student','111',{COLUMN=>'name:firstname',VERSIONS=>10} COLUMN CELL name:firstname timestamp=1338877705167, value=kim 1 row(s) in 0.0250 seconds hbase(main):020:0>
7. 删除表
disable 'tablename' drop 'tablename'
发表评论
-
HBase minor & major compactions
2013-07-23 17:46 1132HBase The Definitive Guide Boo ... -
hbase-0.92.1-cdh4.1.3的HTablePool实现
2013-06-28 18:29 2291hbase-0.92.1-cdh4.1.3的HTablePo ... -
HBase scannerCaching&caching
2013-06-25 23:22 2498HBase Version: hbase-0.94.6-c ... -
HBase HLog结构和原理
2013-04-11 21:06 15010一. HLog在HDFS上位置和RegionServer对 ... -
查看HBase表在HDFS中的文件结构
2013-03-30 18:41 26669为了查看HBASE表在HDFS中的文件结构. 在HBAS ... -
HBase -ROOT-和.META.表结构
2013-03-29 17:35 16388在HBase中,大部分的操作都是在RegionServe ... -
HBase架构图
2013-03-27 17:59 2990HBase系统架构图 Client HBase C ... -
HBase hbase-site.xml 参数
2013-03-27 11:04 12847该文档是用hbase默认配置文件生成的,文件源是 hbase ... -
HBase 自动安装shell脚本
2013-03-23 17:46 1116#!/usr/bin/env bash #greatwqs ... -
HBase性能优化方法总结
2013-03-15 23:49 2942本文主要是从HBase应用程序设计与开发的角度,总结 ... -
HBase修改表TTL值
2012-12-05 10:33 110541.创建测试表 hbase(main):010:0> ... -
HBase: HTablePool重构及优化
2012-08-25 14:57 7687HBase Version: hbase-0.90.3-c ... -
HBase 官方文档 中文版
2012-07-03 13:04 16843HBase 官方文档 Copyri ... -
Bigtable: A Distributed Storage System for Structured Data
2012-06-01 16:46 2486OSDI '06 Paper Pp. <!-- CHA ...
相关推荐
HBase Shell命令大全_monday的博客-CSDN博客_hbase shell.html
批量执行hbase shell 命令 #!/bin/bash source /etc/profile exec $HBASE_HOME/bin/hbase shell <<EOF truncate 'tracker_total_apk_fact_zyt' major_compact('t_abc') disable 't_abc' drop 't_abc' create...
在本文中,我们将深入探讨HBase Shell命令操作,特别是如何创建和管理HBase表,以及进行数据的增、删、改、查等基本操作。HBase是一个分布式、高性能的NoSQL数据库,它基于Google的Bigtable设计,适用于大规模数据...
根据上述描述,可以看出HBase Shell命令是管理HBase数据库中数据的重要工具,通过一系列命令可以轻松地执行复杂的操作。同时,HBase作为一个大数据存储解决方案,其在大规模数据处理和存储方面的能力不容小觑。熟练...
在这里,我们将深入探讨HBase Shell的各种命令。 1. **创建表(create)**: 使用`create '表名', '列族'`命令来创建表,如`create 'myTable', 'fam1'`。列族是HBase中的核心概念,存储相同类型的数据,可以有多个...
Hadoop 中 HBase Shell 命令的详解 Hadoop 中 HBase Shell 命令是 HBase 的一种交互式 Shell,用于与 HBase 进行交互式通信。HBase 使用 Hadoop 文件系统来存储数据,所有的任务都发生在 HDFS 上。HBase Shell 命令...
以下是一些HBase Shell的基本操作命令的详细说明: 1. **创建表** (`create`): 使用`create`命令创建一个新的HBase表。例如: ``` create '表名称', '列名称 1','列名称 2','列名称 N' ``` 这里的`表名称`是你...
实验的目标是让你理解HBase在Hadoop架构中的地位,以及掌握通过Shell命令和Java API进行基本操作的方法。 首先,让我们来看看实验的平台配置。实验要求的操作系统是Linux,这通常是大数据处理的首选平台,因为它...
在HBase Shell中输入`help`命令,可以查看所有可用的HBase Shell命令和它们的使用说明。这些信息对于使用HBase Shell进行操作非常有帮助。 3. 建表 使用`create`命令可以在HBase中创建一个新的表。创建表的基本语法...
2. **熟练使用HBase操作常用的Shell命令**:通过HBase Shell,用户可以执行诸如创建表、插入数据、查询数据、删除表等一系列管理操作。 3. **熟悉HBase操作常用的Java API**:Java API允许开发者在应用程序中直接与...
### HBase Shell 常用命令详解 #### 一、概述 HBase 是一个分布式的、面向列的开源数据库,其设计受到了 Google 的 Bigtable 的启发。它非常适合于非结构化数据存储,提供了高可靠性、高性能、面向列、可伸缩等特点...
Hadoop 和 HBase 常用 shell 命令 在大数据处理中,Hadoop 和 HBase 是两个非常重要的组件。Hadoop 是一个分布式计算框架,用于处理大规模数据,而 HBase 是一个基于 Hadoop 的分布式数据库,用于存储和处理大规模...
### HBase Shell 常用命令详解 #### 一、HBase Shell 概述 HBase Shell 是一个基于命令行的工具,用于与HBase进行交互。它提供了一系列丰富的命令来执行基本的数据管理任务,例如创建表、插入数据、查询数据等。...
以下是一些常用的HBase Shell命令: 1. **create**:创建表,如`create 'testTable', 'cf'` 创建一个名为testTable的表,包含一个列族cf。 2. **put**:向表中插入数据,如`put 'testTable', 'row1', 'cf:q1', '...
### HBase Shell 命令详解 #### 一、概述 HBase Shell 是一个命令行工具,用于与 HBase 数据库进行交互。它提供了一系列的命令来管理表、执行数据定义语言 (DDL) 和数据操纵语言 (DML) 操作等。通过 HBase Shell,...
在HBase这个分布式列式数据库中,Shell是一个用于与HBase交互的命令行工具,它提供了丰富的命令来执行各种操作。以下是对HBase Shell中一些常用命令的详细说明: 1. **创建表**: `create '表名称', '列族名称 1',...
根据提供的文件信息,本文将详细介绍HBase的Shell操作及其应用场景,包括如何创建表、插入数据、查询数据等关键操作。 ### HBase Shell简介 HBase Shell是HBase提供的一种交互式命令行工具,用于执行HBase操作。它...
HBase Shell 提供了大多数的 HBase 命令,通过 HBase Shell,用户可以方便地创建、删除及修改表,还可以向表中添加数据,列出表中的相关信息等。本节介绍一些常用的命令和具体操作,并讲解如何使用命令行实现一个...