下载:http://mirror.bit.edu.cn/apache/hbase/stable/

官方指南:http://abloz.com/hbase/book.html

安装配置:

解压:

tar -xzvf hbase-0.96.0-hadoop1-bin.tar.gz

进入$hbase/lib下查看相关的hadoop包,看是哪个版本的hadoop。

此处只记录伪分布式Hbase的安装。

配置参数,修改hbase-site.xml:

  1. <configuration>
  2. ...
  3. <property>
  4. <name>hbase.rootdir</name>
  5. <value>hdfs://localhost:9000/hbase</value>
  6. <description>The directory shared by RegionServers.
  7. </description>
  8. </property>
  9. <property>
  10. <name>dfs.replication</name>
  11. <value>1</value>
  12. <description>The replication count for HLog & HFile storage. Should not be greater than HDFS datanode count.
  13. </description>
  14. </property>
  15. ...
  16. </configuration>

伪分布式启动:

伪分布式是基于HDFS的,所以需要先启动HDFS.

之后启动HBase

sh start-hbase.sh

不出意外的报错:

dat@dat-HP:/opt/hbase-0.96/bin$ sh start-hbase.sh 
start-hbase.sh: 79: /opt/hbase-0.96/bin/hbase-config.sh: [[: not found
start-hbase.sh: 88: /opt/hbase-0.96/bin/hbase-config.sh: [[: not found
start-hbase.sh: 53: [: false: unexpected operator

localhost: zookeeper running as process 24164. Stop it first.
starting master, logging to /opt/hbase-0.96/bin/../logs/hbase-dat-master-dat-HP.out
Could not start ZK at requested port of 2181.  ZK was started at port: -1.  Aborting as clients (e.g. shell) will not be able to find this ZK quorum.

看样子是2181被占用了,查看占用2181端口的进程:

lsof -i:2181

  1. dat@dat-HP:/opt/hbase-0.96/logs$ lsof -i:2181
  2. COMMAND   PID USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
  3. java    24164  dat   87u  IPv6 2800953      0t0  TCP *:2181 (LISTEN)

ps -ef|grep 24164

  1. dat@dat-HP:/opt/hbase-0.96/logs$ ps -ef|grep 24164
  2. dat      24164 24151  0 10:09 ?        00:00:03 /opt/jdk1.7.0_25/bin/java -Dproc_zookeeper -XX:OnOutOfMemoryError=kill -9 %p -Xmx1000m -XX:+UseConcMarkSweepGC -Dhbase.log.dir=/opt/hbase-0.96/bin/../logs -Dhbase.log.file=hbase-dat-zookeeper-dat-HP.log -Dhbase.home.dir=/opt/hbase-0.96/bin/.. -Dhbase.id.str=dat -Dhbase.root.logger=INFO,RFA -Dhbase.security.logger=INFO,RFAS org.apache.hadoop.hbase.zookeeper.HQuorumPeer start

显示已经是hbase的zookeeper服务,杀掉pid,重试,

  1. dat@dat-HP:/opt/hbase-0.96/bin$ ./start-hbase.sh
  2. starting master, logging to /opt/hbase-0.96/bin/../logs/hbase-dat-master-dat-HP.out

正常启动,检测jps

  1. dat@dat-HP:/opt/hbase-0.96/bin$ jps
  2. 25644 HMaster
  3. 23468 TaskTracker
  4. 23199 SecondaryNameNode
  5. 23307 JobTracker
  6. 25849 Jps
  7. 22827 NameNode
  8. 23031 DataNode

正常。。。

HBase Shell

编辑/etc/profile加入hbase_home,重新生效,source /etc/profile

  1. export PIG_INSTALL=/opt/pig-0.12.0
  2. export PATH=$PATH:$PIG_INSTALL/bin
  3. export PIG_CLASSPATH=/opt/hadoop-1.2.1/conf
  4. export HIVE_HOME=/opt/hive-0.12.0
  5. export PATH=$HIVE_HOME/bin:$HIVE_HOME/conf:$PATH
  6. export ANT_HOME=/opt/ant
  7. export PATH=$PATH:$ANT_HOME/bin
  8. export HBASE_HOME=/opt/hbase-0.96
  9. export PATH=$PATH:$HBASE_HOME/bin

hbase shell进入:

  1. dat@dat-HP:/opt/hbase-0.96/bin$ hbase shell
  2. HBase Shell; enter 'help<RETURN>' for list of supported commands.
  3. Type "exit<RETURN>" to leave the HBase Shell
  4. Version 0.96.0-hadoop1, r1531434, Fri Oct 11 15:11:29 PDT 2013
  5. hbase(main):001:0>

输入help,会列出hbase shell所支持的命令

shutdown是关闭hbase集群,exit是退出hbase shell。

HBase Shell 练习

建表

hbase(main):006:0> create 'test','cf'

列出所有表

hbase(main):007:0> list
TABLE                                                                               
test                                                                                
1 row(s) in 0.0440 seconds

=> ["test"]

插入数据

hbase(main):008:0> put 'test','row1','cf:a','value1'
0 row(s) in 0.0750 seconds

hbase(main):009:0> put 'test','row2','cf:b','value2'
0 row(s) in 0.0080 seconds

hbase(main):010:0> put 'test','row3','cf:c','value3'
0 row(s) in 0.0060 seconds

检查插入情况

hbase(main):011:0> scan 'test'
ROW                    COLUMN+CELL                                                  
 row1                  column=cf:a, timestamp=1386389158263, value=value1           
 row2                  column=cf:b, timestamp=1386389170821, value=value2           
 row3                  column=cf:c, timestamp=1386389185954, value=value3           
3 row(s) in 0.0450 seconds

get一行

hbase(main):012:0> get 'test','row2'
COLUMN                 CELL                                                         
 cf:b                  timestamp=1386389170821, value=value2                        
1 row(s) in 0.0140 seconds

disable之后drop表

hbase(main):013:0> disable 'test'
0 row(s) in 1.4220 seconds

hbase(main):014:0> drop 'test'
0 row(s) in 0.2740 seconds

hbase(main):015:0> list
TABLE                                                                               
0 row(s) in 0.0270 seconds

=> []

Ubuntu 安装HBase的更多相关文章

  1. Ubuntu 12.04上安装HBase并运行

    Ubuntu 12.04上安装HBase并运行 作者:凯鲁嘎吉 - 博客园 http://www.cnblogs.com/kailugaji/ 一.HBase的安装 在官网上下载HBase-1.1.2 ...

  2. 【转】在Ubuntu中安装HBase

    原博客出自于: http://blog.fens.me/category/%E6%95%B0%E6%8D%AE%E5%BA%93/ 感谢! Posted: Apr 3, 2014 Tags: Hado ...

  3. HBase伪分布式安装(HDFS)+ZooKeeper安装+HBase数据操作+HBase架构体系

    HBase1.2.2伪分布式安装(HDFS)+ZooKeeper-3.4.8安装配置+HBase表和数据操作+HBase的架构体系+单例安装,记录了在Ubuntu下对HBase1.2.2的实践操作,H ...

  4. Mac OS、Ubuntu 安装及使用 Consul

    Consul 概念(摘录): Consul 是 HashiCorp 公司推出的开源工具,用于实现分布式系统的服务发现与配置.与其他分布式服务注册与发现的方案,比如 Airbnb 的 SmartStac ...

  5. ubuntu安装mysql

    好记性不如烂笔头,记录一下,ubuntu安装mysql的指令. 安装MySQL: sudo apt-get install mysql-server sudo apt-get install mysq ...

  6. ubuntu安装vim时提示 没有可用的软件包 vim,但是它被其它的软件包引用了 解决办法

    ubuntu安装vim时提示 没有可用的软件包 vim-gtk3,但是它被其它的软件包引用了 解决办法 本人在ubuntu系统安装vim  输入 sudo apt-get install vim 提示 ...

  7. 安装HBase

    安装HBase 1.默认已经安装好java+hadoop+zookeeper 2.下载对应版本的HBase 3.解压安装包 tar zxvf hbase-1.0.2-bin.tar.gz 4.配置环境 ...

  8. docker 1.8+之后ubuntu安装指定版本docker-engine

    这边记录ubuntu安装过程,首先是官网文档 If you haven’t already done so, log into your Ubuntu instance. Open a termina ...

  9. debian/ubuntu安装桌面环境

    apt-get install xorg apt-get install gnome 然后startx ubuntu 安装Gnome桌面 1.安装全部桌面环境,其实Ubuntu系列桌面实际上有几种桌面 ...

随机推荐

  1. DataBindings的用法

    在C#操作数据库过程中,针对一般的文本控件,比如TextBox,Label等,我们赋值直接使用类似TextBox.Text=****的方式来进行,这种方式从某种意义上来说的确是最简便的方式,但是对于复 ...

  2. 数据库 DB MySQL 基本操作 CRUD 多表 MD

    操作数据库 创建数据库:create 创建一个名称为mydb1的数据库 create database mydb1; 创建一个使用gbk字符集的mydb2数据库 create database myd ...

  3. [Python爬虫] 之八:Selenium +phantomjs抓取微博数据

    基本思路:在登录状态下,打开首页,利用高级搜索框输入需要查询的条件,点击搜索链接进行搜索.如果数据有多页,每页数据是20条件,读取页数 然后循环页数,对每页数据进行抓取数据. 在实践过程中发现一个问题 ...

  4. 在低带宽或不可靠的网络环境中安装 Visual Studio 2017

    在低带宽或不可靠的网络环境中安装 Visual Studio 2017 2017-4-141 分钟阅读时长 作者  https://docs.microsoft.com/zh-cn/visualstu ...

  5. C经典之9-system,if,do,while---ShinePans

    #include <stdio.h> #include <conio.h> #include <stdlib.h> //system(); 这个指令须要用到此头文件 ...

  6. 【转】IT新人如何快速成长

    主动积极 主动积极包括很多方面了,主动学习.主动思考.主动承担责任等等.我觉得主动性很重要,如果你能做到这一点,那么肯定会把工作做的很好的. 学会学习 公司不是学校,需要改变由老师灌输知识的学习方式. ...

  7. synchronized探究

    synchronized的加锁方式 synchronized的本质是给对象上锁,对象包括实例对象,也包括类对象.常见的加锁方式有下面几种写法:(1)在非static方法上加synchronized,例 ...

  8. CentOS6.5搭建MySQL5.1主从复制

    环境: mysql> select version(); +------------+ | version() | +------------+ | 5.1.73-log | +-------- ...

  9. UI_storyboard实现页面回调

    新建类 注意继承关系 #import <UIKit/UIKit.h> @interface CustomPopIt : UIStoryboardSegue @end #import &qu ...

  10. mysql last_insert_id() (转载)

    先来看看官方的说明 The ID that was generated is maintained in the server on a per-connection basis. This mean ...