1、搭建环境
系统:centos7文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
jdk:;文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
hadoop:;文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
zookeeper:;文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
hbase:2.2.4文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
2、说明
搭建hbase前提必须具有以下环境:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
1、JDK安装完整并配置好环境变量文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
2、hadoop搭建三个集群,并配置好环境变量文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
3、zookeeper正常启动单机版本,并配置环境变量文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
hbase配置(单机)
1、官网下载包:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
地址:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-dMcnCfOh-1589853306074)(img\)]文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
2、将包上传到自己的服务器上并解压文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
tar -zxvf
3、配置 conf/hbase-env.sh文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
vim conf/hbase-env.sh
添加以下内容文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
export JAVA_HOME=/base/JDK/jdk.0_221
export HBASE_MANAGES_ZK=false
export HBASE_HOME=/base/hbase/hbase-2.2.4
export HADOOP_HOME=/base/hadoop/hadoop-
export HBASE_LOG_DIR=${HBASE_HOME}/logs
4、配置 conf/文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
vim conf/
添加以下内容文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
<configuration><property><name>hbase.rootdir</name><value>hdfs://hadoop22:9000/HBase</value></property><property><name>hbase.cluster.distributed</name><value>true</value></property><property><name>hbase.master.port</name><value>16000</value></property><property><name>hbase.zookeeper.quorum</name><value>192.168.85.21</value></property></configuration>
5、启动文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
./bin/
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
查看是否启动成功文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
jps
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
可以看到如图所示中只启动了一个HRegionServer,还差一个Hmaster没有起来,如果正常来说,HMaster应该也启动的。但是并没有启动,这时候需要查看日志哪里出了问题。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
6、查看日志
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
在网上好多博客都说在配置文件conf/中添加以下配置就可以解决,但是事实上这几行配置并不是解决这个问题的根本问题。这配置只是在不连接HDFS时候需要加的配置。我们可以在官方文档中对这条配置的具体说明。可自行查看。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
<property><name>hbase.unsafe.stream.capability.enforce</name><value>false</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>
导致Hmaster启动失败的根本原因是我们下载下来的包中的hadoop jar包的版本和我们本地启动的hadoop版本不一致而导致的。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
因此需要我们去官网下载源码重新编译hbase包,并配置对应自己安装好的hadoop 版本去编译。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
7、重新编译文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
1)、将下载的源码解压文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
2)、如图所示在该目录中打进行打开文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
Gitt shell 命令行(可自行去下载安装Git客户端,windos cmd好像不行,我自己试了好几次)
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
3)、重新编译命令文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
mvn clean package -DskipTests assembly:single -Dhadoop.profile=3.0 -Dhadoop-three.version=
three.version=中的是需要跟自己一直的hadoop版本号。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
重新编译打包时间过程有点长,耐心等待。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
最后打包成功,去hbase-assembly 目录的target中找到对应的包文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
把新编译后的包上传服务器,再进行上面的配置就可以正常启动了。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html
web页面访问地址:http://IP:16010
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/sjk/19233.html