阿裡雲輕量級伺服器在 Hadoop2.7.3 僞分布式環境下安裝配置 HBASE1.2.4
-
- HBASE簡介
- HBASE下載下傳與解壓
- 修改HBASE配置檔案
- 配置環境變量
- 啟動服務
- 小結
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指令來下載下傳:
[email protected]: wget https://archive.apache.org/dist/hbase/1.2.4/hbase-1.2.4-bin.tar.gz
使用tar指令解壓到指定路徑:
[email protected]: sudo tar -zxvf hbase-1.2.4-bin.tar.gz -C /usr/
修改hbase-1.2.4檔案夾的權限
[email protected]: sudo chown -R hadoop:hadoop /usr/hbase-1.2.4
修改HBASE配置檔案
修改hbase-env.sh檔案:
[email protected]:/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檔案:
[email protected]:/usr/hbase-1.2.4/conf$ sudo vi hbase-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl" target="_blank" rel="external nofollow" ?>
<!--
/**
*
* 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
[email protected]:/usr/hbase-1.2.4/conf$ sudo vi regionservers
添加 localhost 即可。
由于hbase.zookeeper.property.dataDir配置為/usr/tmp/zookeeper,是以要在/usr下建立tmp檔案夾,并将檔案夾所有者修改為hadoop
[email protected]:/usr$ mkdir /usr/tmp
[email protected]:/usr$ sudo chown -R hadoop:hadoop tmp/
配置環境變量
[email protected]:/usr/hbase-1.2.4/conf$ vi ~/.bashrc
在末尾處添加以下内容:
export HBASE_HOME=/usr/hbase-1.2.4
export PATH=$HBASE_HOME/bin:$PATH
将修改應用于系統:
[email protected]:/usr/hbase-1.2.4/conf$ source ~/.bashrc
啟動服務
注意啟動順序,先啟動 hadoop
[email protected]:/usr/hbase-1.2.4/conf$ start-all.sh
再啟動 hbase
[email protected]:/usr/hbase-1.2.4/conf$ start-hbase.sh
檢視是否啟動成功
[email protected]:/usr/hbase-1.2.4/conf$ jps
出現以下内容即啟動成功
[email protected]:/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工作台
[email protected]:/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> [email protected]:/usr/hbase-1.2.4/conf$
小結
HBASE 的配置與 hadoop 相比難度還是小了很多的,但如果 hadoop 沒有配置好,在使用HBASE時将會出現一系列出乎意料的問題。
附上一篇阿裡雲安裝 hadoop2.7.x 的指南,希望能對讀者提供幫助:https://blog.csdn.net/qq_44880708/article/details/102909544