机器信息(所有机器之间已配置相互免密登录)
主机名 | 安装组件 | OS | ip |
---|---|---|---|
hadoop301 | HMASTER,HReginServer | centos8 | 192.168.142.101 |
hadoop302 | HReginServer | centos8 | 192.168.142.102 |
hadoop303 | HReginServer | centos8 | 192.168.142.103 |
注意目前HBASE 支持的HADOOP只到3.1.x,但是安装方法是一样的
下载hbase-2.2.4-bin.tar.gz
在hadoop301上执行如下步骤
解压
mv hbase-2.2.4-bin.tar.gz /opt
cd /opt
tar -zxf hbase-2.2.4-bin.tar.gz
mkdir -p /tmp/hbase/pids
修改/opt/hbase-2.2.4/conf/hbase-env.sh
# The directory where pid files are stored. /tmp by default.
# export HBASE_PID_DIR=/var/hadoop/pids
export HBASE_PID_DIR=/tmp/hbase/pids
# Seconds to sleep between slave commands. Unset by default. This
# can be useful in large clusters, where, e.g., slave rsyncs can
# otherwise arrive faster than the master can service them.
# export HBASE_SLAVE_SLEEP=0.1
# Tell HBase whether it should manage it's own instance of ZooKeeper or not.
#使用已经安装的zk 而不是使用hbase 自己带的ZK
export HBASE_MANAGES_ZK=fase
修改/opt/hbase-2.2.4/conf/hbase-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<!-- Hadoop3.x相较于之前的版本来说,在端口的设置上发生了一些变化,先就这些端口变化总结如下:
Namenode ports: 50470 ==> 9871, 50070 ==> 9870, 8020 ==> 9820
Secondary NN ports: 50091 ==> 9869, 50090 ==> 9868
Datanode ports: 50020 ==> 9867, 50010 ==> 9866, 50475 ==> 9865, 50075 ==> 9864 -->
<property>
<name>hbase.rootdir</name>
<value>hdfs://hadoop301:9820/hbase</value>
</property>
<!-- 集群模式 -->
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<!-- zookeeper 配置 -->
<property>
<name>hbase.zookeeper.quorum</name>
<value>hadoop301:2181,hadoop302:2181,hadoop303:2181</value>
</property>
<!-- 不配会出现The procedure WAL relies on the ability to hsync for proper operation during component failures, but the underlying filesystem does not support doing so. Please check the con
fig value of 'hbase.procedure.store.wal.use.hsync' to set the desired level of robustness and ensure the config value of 'hbase.wal.dir' points to a FileSystem mount that can provide it -->
<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>
</configuration>
设置环境变量~/.bashrc
export HBASE_HOME=/opt/hbase-2.2.4
export PATH=$PATH:$HIVE_HOME/bin
export PATH=$PATH:$HBASE_HOME/bin
修改/opt/hbase-2.2.4/conf/regionservers
hadoop301
hadoop302
hadoop303
传送到hadoop302 hadoop303
rsync -aup /opt/hbase-2.2.4 <username>@hadoop302:/opt
rsync -aup /opt/hbase-2.2.4 <username>@hadoop303:/opt
启动
#创建hbase 目录,与hbase.rootdir 对应
hadoop fs -mkdir /hbase
# 在哪台机器启动start-hbase 脚本,哪太机器就是master
/opt/hbase-2.2.4/bin/start-hbase.sh
#方式2 分别在每台机器执行
/opt/hbase-2.2.4/bin/hbase/hbase-daemon.sh start/stop master/regionserver
#进入hbase shell
[roger@hadoop301 bin]$ hbase shell
/opt/hadoop-3.1.3/libexec/hadoop-functions.sh:行2360:
# 可以忽略这类错误
HADOOP_ORG.APACHE.HADOOP.HBASE.UTIL.GETJAVAPROPERTY_USER: 错误的替换
/opt/hadoop-3.1.3/libexec/hadoop-functions.sh:行2455: HADOOP_ORG.APACHE.HADOOP.HBASE.UTIL.GETJAVAPROPERTY_OPTS: 错误的替换
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.2.4, r67779d1a325a4f78a468af3339e73bf075888bac, 2020年 03月 11日 星期三 12:57:39 CST
Took 0.0080 seconds
hbase(main):001:0> status
1 active master, 0 backup masters, 3 servers, 0 dead, 0.6667 average load
Took 0.5552 seconds
hbase(main):002:0>