下载: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. 9个实用的Javascript代码高亮脚本

    代码高亮很有用,特别是在需要在网站或者blog中显示自己编写的代码的时候,或者给其他人查看或调试语法错误的时候.我们可以将代码高亮,以便阅读者可以十分方便的读取代码块,增加用户阅读代码的良好体验. 目 ...

  2. [Grunt] External Config

    Let's combine uglifying, watching, and config stuff into one Grunt file to make it more of a standar ...

  3. reportservice报表单元格依据条件显示不同的颜色

    有时候.我们须要依据条件,让单元格显示不同的颜色: watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQveV9mMTIz/font/5a6L5L2T/fontsi ...

  4. EXPDP/IMPDP与EXP/IMP在不同用户和表空间之间迁移数据的实现方法

    1. EXPDP/IMPDP方式 SQL> create user zlm identified by zlm; User created. SQL> grant connect,reso ...

  5. .NET破解之繁星代码生成器

    本教程只能用于学习研究,不可进行任何商业用途.如有使用,请购买正版,尊重他人劳动成果和知识产权! 对象:繁星代码生成器0.96 环境:Win7 x64 工具:exeinfoPE(查壳).de4dot ...

  6. html中嵌入flvplayer.swf播放器,播放视频

    只需要改动红色的代码: <object classid='clsid:D27CDB6E-AE6D-11cf-96B8-4445535411111' codebase='http://downlo ...

  7. 微信小程序 - 五星评分(含半分)

    转载自:http://blog.csdn.net/column/details/13721.html     演示:     下载:小程序-星级评论.zip  

  8. MySQL定位锁争用比较严重的表

    1:查看当前的事务 mysql> SELECT * FROM information_schema.innodb_trx \G 2:查看当前锁定的事务 mysql> SELECT * FR ...

  9. 【Linux】cd命令

    用途 cd命令的主要作用是变换目录 全称 cd的全称是Change Directory   案例 以下是一些基础的cd命令操作(酒红色字体为命令 ,蓝色字体为解释字体) [root@bigdata ~ ...

  10. 【BIRT】报表显示不全

    使用BIRT开发了一张报表,预期效果如下 但是开发完成后预览效果如下: 最后的合计竟然没有了,那么怎么处理呢 鼠标点击Layout窗口空白部分,找到布局,切换为自动布局,如下图所示: