Hadoop 单机搭建 Hbase单机模式搭建

Posted 桥头堡洗脚城

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Hadoop 单机搭建 Hbase单机模式搭建相关的知识,希望对你有一定的参考价值。

Hbase官网下载地址:https://hbase.apache.org

本案例使用:hbase-2.1.9-bin.tar.gz

                  hbase-1.6.0-bin.tar.gz

                 hbase-1.4.13-bin.tar.gz

一、上传并解压安装包

1、将hbase-2.1.9-bin.tar.gz文件上传到/opt/softwares/文件夹

2、解压

tar -zxf /opt/softwares/hbase-2.1.9-bin.tar.gz -C /opt/modules/

tar -zxf /opt/softwares/hbase-1.6.0-bin.tar.gz -C /opt/modules/

tar -zxf /opt/softwares/hbase-1.4.13-bin.tar.gz -C /opt/modules/

 

二、hbase-env.sh 文件配置

修改hbase安装目录下的conf/hbase-env.sh,配置关联的JDK ( /opt/modules/hbase-2.1.9/conf )

export JAVA_HOME=/opt/modules/jdk1.8.0_181

  #启动自带的zookeeper

  export HBASE_MANAGES_ZK=true

 

三、hbase-site.xml 文件配置

修改hbase安装目录下的conf/hbase-site.xml,配置关联的JDK ( /opt/modules/hbase-2.1.9/conf ),创建临时目录 

mkdir /opt/modules/hbase-2.1.9/tmp
mkdir /opt/modules/hbase-1.6.0/tmp
mkdir /opt/modules/hbase-1.4.13/tmp
<configuration>
   <!-- 用来持久化HBase  需要与hadoop core-site.xml 中fs.defaultFS 一致 -->
   <property>
        <name>hbase.rootdir</name>
        <value>file:///home/hadoop/hbase</value>
    </property>  
<!-- ZooKeeper的zoo.conf中的配置。 快照的存储位置 --> <property> <name>hbase.zookeeper.property.dataDir</name> <value>/home/hadoop/zookeeper</value>
</property>
   <!-- 本地文件系统的临时文件夹。可以修改到一个更为持久的目录上。(/tmp会在重启时清除) --> 
<property> <name>hbase.tmp.dir</name> <value>/opt/modules/hbase-2.1.9/tmp</value> </property>
</configuration>

<configuration>
   <!-- 用来持久化HBase  需要与hadoop core-site.xml 中fs.defaultFS 一致 -->
   <property>
        <name>hbase.rootdir</name>
        <value>file:///home/hadoop/hbase160</value>
    </property>  
<!-- ZooKeeper的zoo.conf中的配置。 快照的存储位置 --> <property> <name>hbase.zookeeper.property.dataDir</name> <value>/home/hadoop/zookeeper160</value>
</property>
   <!-- 本地文件系统的临时文件夹。可以修改到一个更为持久的目录上。(/tmp会在重启时清除) --> 
<property> <name>hbase.tmp.dir</name> <value>/opt/modules/hbase-1.6.0/tmp</value> </property>
</configuration>


<configuration>
   <!-- 用来持久化HBase  需要与hadoop core-site.xml 中fs.defaultFS 一致 -->
   <property>
        <name>hbase.rootdir</name>
        <value>file:///home/hadoop/hbase1413</value>
    </property>  
<!-- ZooKeeper的zoo.conf中的配置。 快照的存储位置 --> <property> <name>hbase.zookeeper.property.dataDir</name> <value>/home/hadoop/zookeeper1413</value>
</property>
   <!-- 本地文件系统的临时文件夹。可以修改到一个更为持久的目录上。(/tmp会在重启时清除) --> 
<property> <name>hbase.tmp.dir</name> <value>/opt/modules/hbase-1.4.13/tmp</value> </property>
</configuration>

 

四、启动hbase

[hadoop@centos01 bin]$ cd /opt/modules/hbase-2.1.9/bin
或者
[hadoop@centos01 bin]$ cd /opt/modules/hbase-1.6.0/bin
或者
[hadoop@centos01 bin]$ cd /opt/modules/hbase-1.4.13/bin
[hadoop@centos01 bin]$ [hadoop@centos01 bin]$ ./start-hbase.sh 
SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding
in [jar:file:/opt/modules/hadoop-2.8.2/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/opt/modules/hbase-2.1.9/lib/client-facing-thirdparty/slf4j-log4j12-1.7.25.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] running master, logging to /opt/modules/hbase-2.1.9/bin/../logs/hbase-hadoop-master-centos01.out [hadoop@centos01 bin]$ jps 37889 HMaster 41891 Jps

五、测试

[hadoop@centos01 ~]$ sh /opt/modules/hbase-2.1.9/bin/hbase shell
或者
[hadoop@centos01 ~]$ sh /opt/modules/hbase-1.6.0/bin/hbase shell
或者
[hadoop@centos01 ~]$ sh /opt/modules/hbase-1.4.13/bin/hbase shell
SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/opt/modules/hadoop-2.8.2/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/opt/modules/hbase-2.1.9/lib/client-facing-thirdparty/slf4j-log4j12-1.7.25.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 Use "help" to get list of supported commands. Use "exit" to quit this interactive shell. For Reference, please visit: http://hbase.apache.org/2.0/book.html#shell Version 2.1.9, rec4145ba5dc9cd30d4eb700bca2de2d08104207c, Tue Feb 11 03:49:57 UTC 2020 Took 0.0153 seconds hbase(main):001:0> list TABLE 0 row(s) Took 1.2388 seconds => [] hbase(main):002:0>
http://192.168.0.181:16010

 

启动
sh /opt/modules/hbase-2.1.9/bin/start-hbase.sh
sh /opt/modules/hbase-1.6.0/bin/start-hbase.sh
sh /opt/modules/hbase-1.4.13/bin/start-hbase.sh
停止 
sh
/opt/modules/hbase-2.1.9/bin/stop-hbase.sh
sh /opt/modules/hbase-1.6.0/bin/stop-hbase.sh
sh /opt/modules/hbase-1.4.13/bin/stop-hbase.sh
连接 
sh
/opt/modules/hbase-2.1.9/bin/hbase shell
sh /opt/modules/hbase-1.6.0/bin/hbase shell
sh /opt/modules/hbase-1.4.13/bin/hbase shell

 

⚠️ hbase-1.6.0-bin.tar.gz 部署的坑

Hbase启动时,出现警告:
[hadoop@hadoop000 ~]$ start-hbase.sh 
starting master, logging to /home/hadoop/app/hbase-1.2.0-cdh5.7.0/logs/hbase-hadoop-master-hadoop000.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
hadoop000: starting regionserver, logging to /home/hadoop/app/hbase-1.2.0-cdh5.7.0/bin/../logs/hbase-hadoop-regionserver-hadoop000.out
在 $HBASE_HOME/conf/hbase-env.sh 
# 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"
根据注释说明,将两个 export 注释掉即可

 

 

 

 

 

 

结束

以上是关于Hadoop 单机搭建 Hbase单机模式搭建的主要内容,如果未能解决你的问题,请参考以下文章

HBase基础教程1HBase之单机模式与伪分布式模式安装(转)

hbase_学习_01_HBase环境搭建(单机)

Ubuntu下搭建单机版的hadoop+hbase+zookeeper

大数据学习系列之二 ----- HBase环境搭建(单机)

大数据学习系列之七 ----- Hadoop+Spark+Zookeeper+HBase+Hive集群搭建 图文详解

Mac下hadoop,hive, hbase,spark单机环境搭建