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

hbase安装

 
阅读更多
hbase版本:0.90.4  环境ubuntu  jdk1.6.22  hadoop0.20.2
单机版安装:解压到目录下,最简单的配置只需配置环境变量,编辑conf目录下hbase-env.sh文件
export JAVA_HOME=jdk home目录

export HBASE_OPTS  去掉注释

hbase-site.xml文件中添加
  <property>
    <name>hbase.rootdir</name>
    <value>hdfs://localhost:9900/hbase</value>
    <description>The directory shared by RegionServers.
    </description>
  </property>
  <property>
    <name>dfs.replication</name>
    <value>1</value>
    <description>The replication count for HLog and HFile storage. Should not be greater than HDFS datanode count.
    </description>
  </property>

将hbase数据存入dfs。

然后执行bin/start-hbase.sh即可
starting master, logging to /home/xxx/00ewp/00servers/hbase-0.90.4/bin/../logs/hbase-xxx-master-xxx-A8SR.out
输出如上信息表示启动完毕

执行bin/hbase shell 连接到hbase,创建一个表看一下能否成功,成功表示安装成功,或者看logs目录下的日志。
如果配置分布式模式也可以启动,但是日志会显示一些错误(笔者碰到的是zookeeper连接失败,目前还没解决,后面研究后会发布出来),hbase shell也能连接成功,但是创建表就会报错,显示zookeeper错误。

./hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.90.4, r1150278, Sun Jul 24 15:53:29 PDT 2011

hbase(main):001:0>  create 't1', {NAME => 'f1', VERSIONS => 5}
0 row(s) in 0.8360 seconds
建表成功。
上面的命令创建一个表t1 列名为f1
更多操作参见http://hbase.apache.org/book.html#quickstart

hbase的数据文件默认在/tmp/hbase-${user.name}/hbase目录下 同级目录下也会创建zookeeper目录。需要将


补充:
上面提到的问题已经解决,此前已经在本文补充了,不知是自己没保存还是je给搞丢了,今天才发现,只能再从新补充一下。

上面的问题在查看hbase的日志后发现是连接hadoop失败,因为hbase的lib目录下的hadoop的包比我安装的0.20.2的版本要新,需要用0.20.2的hadoop包替换(这点官网的文档是有说明的,由于本人失误把hbase自带的hadoop包移到hbase_home目录下,在启动hbase时还是加载了改包,导致上面的问题出现);本文是用hadoop-0.20.2-core.jar的包替换hadoop-core-0.20-append-r1056497.jar的包.
(如果采用本地磁盘存储hbase数据,不用替换这里的包,亲测过。)

访问http://localhost:60010/master.jsp会提示
You are currently running the HMaster without HDFS append support enabled. This may result in data loss. Please see the HBase wiki for details.
根据说明查看了hdfs-default.xml中,看到如下说明,20.2的版本有bug不能支持,因此只能作罢。
<property>
  <name>dfs.support.append</name>
  <value>false</value>
  <description>Does HDFS allow appends to files?
               This is currently set to false because there are bugs in the
               "append code" and is not supported in any prodction cluster.
  </description>
</property>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics