2.hbase 安裝

下載和版本選擇

當前我下載的是2.0.4的穩定版,這也是當前公司集羣佈置的版本,靠譜!現在很多公司還在用0.9x/1.x版本,2.x版本相對來說無論是穩定性還是性能都有了較大提升,如果不是爲了考慮兼容,直接下載2.x版本即可。

安裝Java環境

  • 不再贅述

解壓安裝包

如下命令 tar -zxf hbase-2.0.4-bin.tar.gz

bin
CHANGES.md
conf
docs
hbase-webapps
LEGAL
lib
LICENSE.txt
NOTICE.txt
README.txt
RELEASENOTES.md

其中

  • bin爲啓動停止腳本
  • conf爲配置文件
  • lib爲相關依賴jar包

配置

conf/hbase-env.sh中打開註釋,如下設置JAVA_HOME

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.17

conf/hbase-site.xml中如下設置數據存儲位置

<configuration>
    //Here you have to set the path where you want HBase to store its files.
    <property>
        <name>hbase.rootdir</name>
        <value>file:/home/wenzhou/data/hbase</value>
    </property>
    //Here you have to set the path where you want HBase to store its built in zookeeper files.
    <property>
        <name>hbase.zookeeper.property.dataDir</name>
        <value>/home/wenzhou/data/zookeeper</value>
    </property>
</configuration>

這裏hbase.rootdir指定數據存儲位置,我們這裏只是單機安裝測試,實際集羣部署指定爲hdfs://xxx:port即可;單機部署時只需要hbase.zookeeper.property.dataDir指定zookeeper位置來講分佈式的zookeeper數據保存到本地。

正式使用分佈式zookeeper協調的的話,還需要指定分佈式屬性和zookeeper集羣位置,如下

    <property>
        <name>hbase.cluster.distributed</name>
        <value>true</value>
    </property>
    <property>
        <name>hbase.zookeeper.quorum</name>
        <value>test1.dfs.shbt.qihoo.net,test2.dfs.shbt.qihoo.net</value>
    </property>

開啓和測試

bin/start-hbase.sh開啓hbase服務,bin/stop-hbase.sh停止hbase服務。此時可以直接如下運行shell命令行,操作hbase。

bin/hbase shell

輸入list 顯示所有可用表

推薦文檔

  • https://www.yiibai.com/hbase 快速學習hbase安裝和命令
  • 《hbase實戰》 學習hbase基本原理和編程接口
  • 《hbase權威指南》 深入理解hbase,瞭解設計思想

原創,轉載請註明來自

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章