阿里云轻量级服务器在 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 即可。
由于hbase.zookeeper.property.dataDir配置为/usr/tmp/zookeeper,所以要在/usr下新建tmp文件夹,并将文件夹所有者修改为hadoop
hadoop@ubuntu:/usr$ mkdir /usr/tmp
hadoop@ubuntu:/usr$ sudo chown -R hadoop:hadoop tmp/
配置环境变量
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