十、CentOS7安装HBase-2.1.0伪分布式

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/QQB67G8COM/article/details/83864007

背景:2.1.0版本是当前官网的最新版本,首先确认的是其对Java和Hadoop的支持版本

在这里插入图片描述
在这里插入图片描述

一、解压压缩包

tar -zxvf  hbase-2.1.0-bin.tar.gz -C hbase/

二、添加环境变量

普通用户的环境变量的文件:~/.bashrc
全局环境变量文件:/etc/profile
两个都添加同样的配置:
export HBASE_HOME=/
然后在PATH中添加: H B A S E H O M E / b i n C L A S S P A T H {HBASE_HOME}/bin 在CLASSPATH中添加: {HBASE_HOME}/lib/*

三、配置文件

这里有三个重要的配置文件:hbase-site.xml、regionservers和hbase-env.sh
hbase-env.sh中配置:JAVA_HOME=${JAVA_HOME}和export HBASE_MANAGES_ZK=true(true默认使用内置Zookeeper)
regionservers添加的是集群节点,伪分布式只有一个节点,就添加本机主机名master,默认是localhost,不用更改也可以,如果有更多节点通过回车键来进行分隔就行。
hbase-site.xml文件配置:8020是hadoop的hdfs的端口,如果是9000就改成8020

<configuration>
	<property>
    <name>hbase.rootdir</name>
    <value>hdfs://master:8020/user/hbase</value>
 	</property>

  <property>
    <name>hbase.cluster.distributed</name>
    <value>true</value>
  </property>

  <property>
    <name>hbase.master</name>
    <value>master:60000</value>
  </property>

  <property>
		<name>hbase.tmp.dir</name>
		<value>/hadoopeco/hbase/tmp</value>
	</property>
	
  <property>
    <name>hbase.zookeeper.quorum</name>
    <value>master</value>
	</property>
  
  <property>
    <name>hbase.zookeeper.property.clientPort</name>
    <value>2181</value>
  </property>
	
  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/hadoopeco/hbase/zookeeper</value>
  </property>
  	
  <property>
    <name>hbase.unsafe.stream.capability.enforce</name>
    <value>true</value>
    <description>
    	Controls whether HBase will check for stream capabilities (hflush/hsync).
      Disable this if you intend to run on LocalFileSystem, denoted by a rootdir
      with the 'file://' scheme, but be mindful of the NOTE below.
      WARNING: Setting this to false blinds you to potential data loss and
      inconsistent system state in the event of process and/or node failures. If
      HBase is complaining of an inability to use hsync or hflush it's most
      likely not a false positive.
    </description>
	</property>
  
  <!-- <property>
    <name>zookeeper.znode.parent</name>
    <value>/hadoopeco/hbase</value>
  </property> -->
  <property>
    <name>hbase.zookeeper.distributed</name>
    <value>true</value>
  </property>
</configuration>

四、运行HBase

start-hbase.sh or $HBASE_HOME/bin/start-hbase.sh

hadoop running,hbase closed.
在这里插入图片描述
由于是单机伪分布式,只有一个master节点,SecondaryNameNode这个进程很快关闭了,暂不清楚是不是版本问题,在Hadoop3.1.0无此问题,搁置到后面的博客文章解答。
hadoop running,hbase closed.
在这里插入图片描述

五、其它问题

关于HMaster启动失败的问题:
在这里插入图片描述
我第一次启动HBase时就出现这样的问题,也就是HMaster启动后马上自动kill掉了,有时kill快了点还以为没启动过,我的Hadoop环境为3.1.0,一开始以为是版本的问题那么简单,后来将Hadoop的本本降到2.8.5兼容当前的HBase,结果发现还是同样的问题,就是找不到Class,无奈之下只好番了一下lib文件夹,找到htrace所在的文件
在这里插入图片描述
发现其不是在lib的第一级目录中,而是在第二级,有点玄,我将htrace-core-3.1.0-incubating.jar复制到lib的第一级目录中,结果重新启动HBase发现HMaster启动了,我。。。
直接上解决方案:

cp $HBASE_HOME/lib/client-facing-thirdparty/htrace-core-3.1.0-incubating.jar  $HBASE_HOME/lib/

猜你喜欢

转载自blog.csdn.net/QQB67G8COM/article/details/83864007