# HBase

# 一、安装

规划

Node Name Master ZooKeeper RegionServer
master01 yes yes no
slave01 backup yes yes
slave02 no yes yes

# 1.1 安装zookeeper

参考zookeeper

# 1.2 安装Hadoop

参考安装开原版hadoop

# 1.3 配置ssh免密访问

master01需要免密访问slave01和slave02以及它自己,参考SSH免密配置

# 1.4 安装Hbase

  1. 下载解压

访问Hbase (opens new window)官方,下载最新的bin安装包

[root@master01 opt]# tar -xzf hbase-2.4.6-bin.tar.gz
1
  1. 配置环境变量
[root@master01 hbase]# vim /etc/profile.d/my_env.sh
#Hbase
export HBASE_HOME=/opt/hbase
export PATH=$PATH:$HBASE_HOME/bin
1
2
3
4

分发配置

[root@master01 hbase]# xsync /etc/profile.d/my_env.sh
1
  1. 修改hbase-env.sh文件
[root@master01 hbase]# vim conf/hbase-env.sh
# Tell HBase whether it should manage it's own instance of ZooKeeper or not.
export HBASE_MANAGES_ZK=false
1
2
3
  1. 修改hbase-site.xml文件
[root@master01 hbase]# vim conf/hbase-site.xml
    <property>
        <name>hbase.rootdir</name>
        <value>hdfs://master01:8020/HBase</value>
    </property>
    <property>
        <name>hbase.cluster.distributed</name>
        <value>true</value>
    </property>
    <property>
        <name>hbase.zookeeper.quorum</name>
        <value>master01,slave01,slave02</value>
    </property>
1
2
3
4
5
6
7
8
9
10
11
12
13
  1. 修改regionservers文件
master01
slave01
slave02
1
2
3
  1. 单独配置

master01

修改conf/regionservers,把master01去掉,因为它master不跑RegionServers

  1. 单点启动
[root@master01 opt]# hbase-daemon.sh start master
[root@master01 opt]# hbase-daemon.sh start regionserver
1
2
  1. 群启hbase
[tpxcer@master01 opt]$ start-hbase.sh
1
  1. 检查
# jps查看
[tpxcer@master01 logs]$ jpsall
=============== master01 ===============
37907 HMaster
38231 HRegionServer
=============== slave01 ===============
49774 HRegionServer
=============== slave02 ===============
49883 HRegionServer

# hdfs查看
[tpxcer@master01 logs]$ hadoop fs -ls /HBase
Found 12 items
drwxr-xr-x   - tpxcer supergroup          0 2021-09-28 14:03 /HBase/.hbck
drwxr-xr-x   - tpxcer supergroup          0 2021-09-28 14:13 /HBase/.tmp
drwxr-xr-x   - tpxcer supergroup          0 2021-09-28 14:03 /HBase/MasterData
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

访问web-ui http://master01:16010

更新时间: 9/28/2021, 4:58:11 PM