一、安裝準備
1、下載HBASE 0.20.5版本:http://www.apache.org/dist/hbase/hbase-0.20.5/
2、JDK版本:jdk-6u20-linux-i586.bin
3、操作系統:Linux s132 2.6.9-78.8AXS2smp #1 SMP Tue Dec 16 02:42:55 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
4、默認前提是安裝完hadoop 0.20.2版本:
192.168.3.131 namenode
192.168.3.132 datanode
192.168.3.133 datanode
二、操作步驟(默認在namenode上進行)
1、拷貝以上文件到Linux的“/root”目錄下。同時新建目錄“/jz”。
2、安裝JDK,此步省略...
3、解壓hbase到/jz目錄下。tar -zxvf hbase-0.20.5.tar.gz -C /jz
4、修改/jz/hbase-0.20.5/conf/hbase-env.sh文件。指定本地的JDK安裝路徑:
export JAVA_HOME=/usr/java/jdk1.6.0_20
5、修改/jz/hbase-0.20.5/conf/hbase-site.xml。內容如下:
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://m131:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.master.port</name>
<value>60000</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>m131,s132,s133</value>
</property>
</configuration>
6、修改/jz/hbase-0.20.5/conf/regionservers文件(同hadoop的slaves文件內容相同),內容如下:
7、 將 “/jz/hbase-0.20.5” 目錄分別拷貝到192.168.3.132和192.168.3.133下。
8、修改/etc/profile文件,在文件末尾加上環境變量:
export HBASE_HOME=/jz/hbase-0.20.5
export PATH=$PATH:$HBASE_HOME/bin
將文件拷貝到192.168.3.132和192.168.3.133對應的目錄下,分別在各個控制臺輸入:source /etc/profile,使之生效。
9、修改/etc/hosts文件,如下:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost
192.168.3.131 m131
192.168.3.132 s132
192.168.3.133 s133
然后將文件拷貝到192.168.3.132和192.168.3.133對應的目錄下
三、啟動HBase
1、通過shell腳本啟動hbase。
sh /jz/hbase-0.20.5/bin/start-hbase.sh
2、進入/jz/hbase-0.20.5/bin目錄,執行hbsae shell命令,進入hbase控制臺,顯示如下。
[root@m131 conf]# hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Version: 0.20.5, r956266, Sat Jun 19 12:25:12 PDT 2010
hbase(main):001:0>
3、在hbase控制臺輸入list命令,如果正常執行,表示hbase啟動成功。如下:2
hbase(main):001:0> list
0 row(s) in 0.0610 seconds
hbase(main):002:0>
4、WEB查看hbase
四、一些異常的和注意事項
1、安裝hbase 0.20.5版本自帶了zookeeper-3.2.2,所以不需要單獨安裝zookeeper。
2、hbase默認通過zookeeper管理,配置項在/jz/hbase-0.20.5/conf/hbase-env.sh文件中:
# Tell HBase whether it should manage it's own instance of Zookeeper or not.
# export HBASE_MANAGES_ZK=true
如果需要采用自帶安裝的zookeeper,可以將注釋取消,把true修改為false。否則啟動hbase的時候將會提示地址被占用。不過不影響hbase正常使用。
3、通過shell控制臺想hbase插入中文數據將會報錯,這是由于hbase中只是存放字節,采用程序將漢字改為字節錄入即可。
4、在hbase腳本中執行shell命令,如果出現以下錯誤,表示hbase中有節點不能正常運行。
NativeException: org.apache.hadoop.hbase.client.RetriesExhaustedException: Trying to contact region server 192.168.3.139:60020 for region .META.,,1, row '', but failed after 7 attempts.
5、有疑問或是寫的不對的地方歡迎大家發郵件交流:dajuezhao@gmail.com