`
panqili2120
  • 浏览: 88649 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

NO-SQL数据库HBase学习-Get Started

阅读更多

1. 介绍

     

2. 安装

    进入官网下载最新版本:http:// hbase.apache.org/

     下载

#直接下载安装:
$ mkdir hbase-install
$ cd hbase-install
$ wget http://apache.claz.org/hbase/hbase-0.92.1/hbase-0.92.1.tar.gz $ tar xvfz hbase-0.92.1.tar.gz


#####或手动安装
$ mkdir hbase-install
$ mv hbase-0.94.20.tar.gz hbase-install/
$ cd hbase-install/
$ tar xvfz hbase-0.94.20.tar.gz 
x hbase-0.94.20/

     配置及启动HBase服务器

$ export HBASE_HOME=`pwd`/hbase-0.94.20
$ $HBASE_HOME/bin/start-hbase.sh
starting master, logging to /Users/klaus/Documents/study/java/bigdata/hbase-install/hbase-0.94.20/logs/hbase-klaus-master-klaus.local.out

   启动后的管理页面截图

 

3. 简单使用

  •  显示所有表  list
  •  创建表   create 'table', 'column family' 
  •  往表里插入数据      put 'table name' , 'column' , 'key',  'value'
  • 读取表数据    get 'table name', 'column'
  • 读取表里所有数据 scan 'table name'
$ $HBASE_HOME/bin/hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.94.20, r09c60d770f2869ca315910ba0f9a5ee9797b1edc, Fri May 23 22:00:41 PDT 2014

hbase(main):001:0> list
TABLE                                                                           
2014-07-04 00:10:13.517 java[699:1003] Unable to load realm info from SCDynamicStore
0 row(s) in 0.4350 seconds

hbase(main):002:0> creae 'mytable', 'cf'
NoMethodError: undefined method `creae' for #<Object:0xffc7b3a>

hbase(main):003:0> create 'mytable', 'cf'
0 row(s) in 5.1260 seconds

hbase(main):004:0> list
TABLE                                                                           
mytable                                                                         
1 row(s) in 0.0190 seconds

hbase(main):005:0> create 'mytable', 'cf'

ERROR: Table already exists: mytable!

Here is some help for this command:
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}
  hbase> create 't1', 'f1', {SPLITS => ['10', '20', '30', '40']}
  hbase> create 't1', 'f1', {SPLITS_FILE => 'splits.txt'}
  hbase> # Optionally pre-split the table into NUMREGIONS, using
  hbase> # SPLITALGO ("HexStringSplit", "UniformSplit" or classname)
  hbase> create 't1', 'f1', {NUMREGIONS => 15, SPLITALGO => 'HexStringSplit'}


hbase(main):006:0> create 'hello', 'hello'
0 row(s) in 1.0600 seconds

hbase(main):007:0> list
TABLE                                                                           
hello                                                                           
mytable                                                                         
2 row(s) in 0.0220 seconds

hbase(main):008:0> delete
delete            delete_snapshot   deleteall
hbase(main):008:0> delete hello
NameError: undefined local variable or method `hello' for #<Object:0xffc7b3a>

hbase(main):009:0> delete 'hello'

ERROR: wrong number of arguments (1 for 3)

Here is some help for this command:
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. To delete a cell from  't1' at row 'r1' under column 'c1'
marked with the time 'ts1', do:

  hbase> delete 't1', 'r1', 'c1', ts1


hbase(main):010:0> delete 'hello', 'hello'

ERROR: wrong number of arguments (2 for 3)

Here is some help for this command:
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. To delete a cell from  't1' at row 'r1' under column 'c1'
marked with the time 'ts1', do:

  hbase> delete 't1', 'r1', 'c1', ts1


hbase(main):011:0> put 'mytable', 'first', 'cf:message', 'hello HBase'
0 row(s) in 0.0730 seconds

hbase(main):012:0> put 'mytable', 'second', 'cf:foo', 0x0
0 row(s) in 0.0200 seconds

hbase(main):013:0> put 'mytable', 'third', 'cf:bar', 3.14159
0 row(s) in 0.0150 seconds

hbase(main):014:0> get 'mytable', 'hello'
COLUMN                CELL                                                      
0 row(s) in 0.0210 seconds

hbase(main):015:0> get 'mytable', 'cf:foo'
COLUMN                CELL                                                      
0 row(s) in 0.0040 seconds

hbase(main):016:0> get 'mytable', 'first'
COLUMN                CELL                                                      
 cf:message           timestamp=1404404100808, value=hello HBase                
1 row(s) in 0.0140 seconds

hbase(main):017:0> put 'mytable', 'first', 'cf:message', 'newvalue'
0 row(s) in 0.0160 seconds

hbase(main):018:0> get 'mytable', 'first'
COLUMN                CELL                                                      
 cf:message           timestamp=1404404364748, value=newvalue                   
1 row(s) in 0.0170 seconds

hbase(main):019:0> scan 'mytable'
ROW                   COLUMN+CELL                                               
 first                column=cf:message, timestamp=1404404364748, value=newvalue
 second               column=cf:foo, timestamp=1404404148293, value=0           
 third                column=cf:bar, timestamp=1404404164447, value=3.14159     
3 row(s) in 0.0340 seconds

hbase(main):020:0> 

 

  • 大小: 683.9 KB
分享到:
评论

相关推荐

    phoenix-5.0.0-HBase-2.0-client

    "phoenix-5.0.0-HBase-2.0-client" 是一个针对Apache HBase数据库的Phoenix客户端库,主要用于通过SQL查询语句与HBase进行交互。这个版本的Phoenix客户端是为HBase 2.0版本设计和优化的,确保了与该版本HBase的兼容...

    phoenix-core-4.7.0-HBase-1.1-API文档-中文版.zip

    赠送jar包:phoenix-core-4.7.0-HBase-1.1.jar; 赠送原API文档:phoenix-core-4.7.0-HBase-1.1-javadoc.jar; 赠送源代码:phoenix-core-4.7.0-HBase-1.1-sources.jar; 赠送Maven依赖信息文件:phoenix-core-4.7.0...

    phoenix-client-hbase-2.2-5.1.2.jar

    phoenix-client-hbase-2.2-5.1.2.jar

    pinpoint的hbase初始化脚本hbase-create.hbase

    搭建pinpoint需要的hbase初始化脚本hbase-create.hbase

    hbase-meta-repair-hbase-2.0.2.jar

    HBase 元数据修复工具包。 ①修改 jar 包中的application.properties,重点是 zookeeper.address、zookeeper.nodeParent、hdfs....③开始修复 `java -jar -Drepair.tableName=表名 hbase-meta-repair-hbase-2.0.2.jar`

    phoenix-4.14.1-HBase-1.2-client.jar

    phoenix-4.14.1-HBase-1.2-client.jar

    apache-phoenix-5.0.0-HBase-2.0-bin.tar.gz

    Apache Phoenix是构建在HBase之上的关系型数据库层,作为内嵌的客户端JDBC驱动用以对HBase中的数据进行低延迟访问。Apache Phoenix会将用户编写的sql查询编译为一系列的scan操作,最终产生通用的JDBC结果集返回给...

    phoenix-5.0.0-HBase-2.0-client.jar

    hbase phoenix 客户端连接jdbc的jar包,SQuirreL SQL Client,DbVisualizer 等客户端连接hbase配置使用

    spring-boot-starter-hbase自定义的spring-boot的hbasestarter

    而当我们涉及到大数据存储与处理时,Apache HBase作为NoSQL数据库的一员,其强大的分布式存储能力往往被广泛应用。本文将深入探讨如何通过自定义的`spring-boot-starter-hbase`,在Spring Boot项目中轻松进行HBase的...

    腾讯云-云数据库Hbase介绍

    腾讯云数据库HBase是一种基于开源Apache HBase构建的高性能、可伸缩的分布式列存储数据库服务,它为用户提供了面向列的存储结构、海量数据存储以及分布式计算的解决方案。腾讯云数据库HBase在兼容HBase协议的基础上...

    apache-phoenix-4.14.0-HBase-1.2-src.tar.gz

    Apache Phoenix 是一个开源的SQL引擎,它为Apache HBase提供了高性能的关系型数据库查询能力。Phoenix将SQL查询转换为HBase的原生操作,使得开发者能够使用SQL语法与HBase进行交互,而无需深入理解HBase的Java API。...

    apache-phoenix-4.8.1-HBase-1.2-bin.tar.gz

    在标题"apache-phoenix-4.8.1-HBase-1.2-bin.tar.gz"中,我们可以看到这是Apache Phoenix的4.8.1版本,它兼容HBase的1.2版本。这个压缩包是二进制发行版,通常包含了运行Phoenix所需的全部文件,包括JAR包、配置文件...

    藏经阁-云数据库HBase企业级安全解析.pdf

    藏经阁-云数据库HBase企业级安全解析 HBase企业级安全解析是ApsaraDB-HBase产品技术团队天斯云飞天技术汇开源HBase安全介绍的重要组成部分。该文档详细介绍了HBase的安全原理、安全介绍、ACL权限控制、RPC层的安全...

    phoenix-4.14.2-HBase-1.3-client.jar

    phoenix-4.14.2-HBase-1.3-client.jar phoenix-4.14.2-HBase-1.3-client.jar

    7-分布式数据库HBase.ppt

    【分布式数据库HBase详解】 HBase,全称为Hadoop Distributed File System Base,是一个基于Google BigTable设计理念的开源分布式列式数据库。它设计的目标是处理超大规模的数据,支持PB级别的数据量,并可在数千台...

    大数据技术原理与应用-第四章-分布式数据库HBase(2016年1月28日版本).ppt

    【大数据技术原理与应用-第四章-分布式数据库HBase(2016年1月28日版本)】 本章主要介绍了分布式数据库HBase的相关知识,包括其起源、概念、特性以及与传统关系数据库的差异。HBase是Google BigTable的开源实现,...

    apache-phoenix-4.8.1-HBase-0.98-bin.tar

    通过解压 "apache-phoenix-4.8.1-HBase-0.98-bin" 文件,您可以获得 Phoenix 的可执行文件和配置文件,进而安装、配置并在 HBase 上运行 SQL 查询。在实际应用中,理解并掌握这些知识点将极大地提升您在大数据环境中...

    apache-atlas-2.0.0-hbase-hook.tar.gz

    "apache-atlas-2.0.0-hbase-hook.tar.gz" 是一个特定于Apache Atlas 2.0.0版本的HBase Hook压缩包,这意味着它包含了使Apache Atlas与HBase数据库集成的组件。 Apache Atlas的HBase Hook是一个关键的特性,它允许...

    apache-kylin-3.0.2-bin-hbase1x.tar.gz

    Apache Kylin是一个开源的、高性能的大数据分析平台,专门设计用于提供亚秒级的SQL查询性能在PB级别的数据上。这个“apache-kylin-3.0.2-bin-hbase1x.tar.gz”文件是Apache Kylin的3.0.2版本的二进制发行版,针对...

    hbase-sdk是基于hbase-client和hbase-thrift的原生API封装的一款轻量级的HBase ORM框架

    hbase-sdk是基于hbase-client和hbase-thrift的原生API封装的一款轻量级的HBase ORM框架。 针对HBase各版本API(1.x~2.x)间的差异,在其上剥离出了一层统一的抽象。并提供了以类SQL的方式来读写HBase表中的数据。对...

Global site tag (gtag.js) - Google Analytics