HBase安装配置
Posted taojietaoge
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HBase安装配置相关的知识,希望对你有一定的参考价值。
HBase安装配置
HBase的安装有三种模式:单机模式、伪分布式模式、分布式模式。
其中,HBase在单机模式下不使用HSFS,直接将安装文件解压,改个hbase.xml文件就可以运行了;默认情况下HBAse数据是存储在根目录的tmp文件夹下,可以通过start-hbase.sh和stop-hbase.sh命令启动和关闭HBase;而伪分布式和分布式模式下的HBase需要HDFS系统;下面是按伪分布式进行安装配置HBase,配置好了三个集群:tjt01、tjt02、tjt03,hbase安装在tjt02机器上运行。
1、伪分布式安装
HBase下载,官网地址:http://hbase.apache.org/
这里下载的是hbase-1.2.6版本:hbase-1.2.6-bin.tar.gz
1.1 使用HBase自带的zookeeper
HBase使用zookeeper进行管理,HBase本身自带了一个zookeeper,So伪分布式安装可以直接使用HBase自带的zookeeper,无需单独安装zookeeper。
1.2 解压HBase
将HBase hbase-1.2.6版本解压到/usr/local目录下:
[[email protected] opt]# tar -zxvf hbase-1.2.6-bin.tar.gz -C /usr/local
将目录命名为hbase目录:
[[email protected] opt]# cd /usr/local/
[[email protected] local]# mv hbase-1.2.6 hbase
1.3 修改配置文件:
修改配置文件/usr/local/hbase/conf/hbase-en.sh
[[email protected] local]# vi /usr/local/hbase/conf/hbase-env.sh
修改内容如下:
export JAVA_HOME=/opt/jdk1.8.0_181
export HBASE_MANAGES_ZK=true
修改配置文件/usr/local/hbase/conf/hbase-site.xml
[[email protected] local]# vi /usr/local/hbase/conf/hbase-site.xml
增加如下配置:
<property>
<name>hbase.rootdir</name>
<value>hdfs://tjt01:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>tjt02</value>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
1.4 PATH路径到添加
/etc/profile文件增加:export PATH=$PATH:/usr/local/hbase/bin
[[email protected] local]# vi /etc/profile
[[email protected] local]# source /etc/profile
[[email protected] local]#
1.5 启动HBase
启动HBase之前记得启动hdfs,start-hdfs.sh
[[email protected] local]# start-hbase.sh
tjt02: starting zookeeper, logging to /usr/local/hbase/bin/../logs/hbase-root-zookeeper-tjt02.out
starting master, logging to /usr/local/hbase/bin/../logs/hbase-root-master-tjt02.out
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
starting regionserver, logging to /usr/local/hbase/bin/../logs/hbase-root-1-regionserver-tjt02.out
[[email protected] local]#
使用jps命令查看HBase是否启动成功:
HRegionServer、HQuorumPeer、HMaster
1.6 验证HBase
关闭机器tjt02的防火墙:
[[email protected] local]# systemctl stop firewalld
[[email protected] local]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[[email protected] local]#
访问HBase首页: http://172.16.114.131:16010/
使用HBase命令行再次验证:
[[email protected] local]# hbase shell
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/hbase/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/hadoop-2.7.6/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
HBase Shell; enter ‘help<RETURN>‘ for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 1.2.6, rUnknown, Mon May 29 02:25:32 CDT 2017
hbase(main):001:0>
Now,HBase安装配置OK!
以上是关于HBase安装配置的主要内容,如果未能解决你的问题,请参考以下文章