阿里雲輕量型服務器在 Hadoop2.7.x 僞分佈式環境下安裝配置 HBASE1.2.x

阿里雲輕量級服務器在 Hadoop2.7.3 僞分佈式環境下安裝配置 HBASE1.2.4

HBASE簡介

HBASE下載與解壓

下載地址:https://archive.apache.org/dist/hbase/1.2.4/hbase-1.2.4-bin.tar.gz
HBASE各版本地址:https://archive.apache.org/dist/hbase
可使用wget命令來下載:

hadoop@ubuntu: wget https://archive.apache.org/dist/hbase/1.2.4/hbase-1.2.4-bin.tar.gz

使用tar命令解壓到指定路徑:

hadoop@ubuntu: sudo tar -zxvf hbase-1.2.4-bin.tar.gz -C /usr/

修改hbase-1.2.4文件夾的權限

hadoop@ubuntu: sudo chown -R hadoop:hadoop /usr/hbase-1.2.4

修改HBASE配置文件

修改hbase-env.sh文件:

hadoop@ubuntu:/usr/hbase-1.2.4/conf$ sudo vi hbase-env.sh 

添加JAVA_HOME ,並註釋掉部分內容(因爲我們使用java1.8及以上版本):

# The java implementation to use.  Java 1.7+ required.
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/

# Configure PermSize. Only needed in JDK7. You can safely remove it for JDK8+
###export HBASE_MASTER_OPTS="$HBASE_MASTER_OPTS -XX:PermSize=128m -XX:MaxPermSize=128m"
###export HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS -XX:PermSize=128m -XX:MaxPermSize=128m"

修改hbase-site.xml文件:

hadoop@ubuntu:/usr/hbase-1.2.4/conf$ sudo vi hbase-site.xml 
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
/**
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
<configuration>
        <property>
                <name>hbase.rootdir</name>
                <value>hdfs://ubuntu:9000/hbase</value>
        </property>
        <property>
                <name>hbase.zookeeper.property.dataDir</name>
                <value>/usr/tmp/zookeeper</value>
        </property>
        <property>
                <name>hbase.cluster.distributed</name>
                <value>true</value>
        </property>
</configuration>

修改regionservers

hadoop@ubuntu:/usr/hbase-1.2.4/conf$ sudo vi regionservers

添加 localhost 即可。

配置環境變量

hadoop@ubuntu:/usr/hbase-1.2.4/conf$ vi ~/.bashrc

在末尾處添加以下內容:

export HBASE_HOME=/usr/hbase-1.2.4
export PATH=$HBASE_HOME/bin:$PATH

將修改應用於系統:

hadoop@ubuntu:/usr/hbase-1.2.4/conf$ source ~/.bashrc

啓動服務

注意啓動順序,先啓動 hadoop

hadoop@ubuntu:/usr/hbase-1.2.4/conf$ start-all.sh

再啓動 hbase

hadoop@ubuntu:/usr/hbase-1.2.4/conf$ start-hbase.sh

查看是否啓動成功

hadoop@ubuntu:/usr/hbase-1.2.4/conf$ jps

出現以下內容即啓動成功

hadoop@ubuntu:/usr/hbase-1.2.4/conf$ jps
30354 Jps
3763 SecondaryNameNode
4052 NodeManager
4661 HQuorumPeer
4856 HRegionServer
4728 HMaster
3917 ResourceManager
3405 NameNode
3566 DataNode

下面可進入 hbase shell 查看,輸入 hbase shell,出現hbase工作臺

hadoop@ubuntu:/usr/hbase-1.2.4/conf$ hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 1.2.4, r67592f3d062743907f8c5ae00dbbe1ae4f69e5af, Tue Oct 25 18:10:20 CDT 2016

hbase(main):001:0> hadoop@ubuntu:/usr/hbase-1.2.4/conf$ 

小結

HBASE 的配置與 hadoop 相比難度還是小了很多的,但如果 hadoop 沒有配置好,在使用HBASE時將會出現一系列出乎意料的問題。
附上一篇阿里雲安裝 hadoop2.7.x 的指南,希望能對讀者提供幫助:https://blog.csdn.net/qq_44880708/article/details/102909544

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