一、集群安装:
1、需要先搭建Hadoop集群,之后再搭建HBase集群。
0.选择安装的主机
s100 ~ s103
1.jdk
略
2.hadoop
略
3.tar
tar -zxvf ~/downloads/hbase-1.2.6.tar.gz -C /soft/
cd /soft
scp -r hbase* centos@s101:/soft
scp -r hbase* centos@s102:/soft
scp -r hbase* centos@s103:/soft
ln -s hbase-1.2.6.tar.gz hbase //每个节点都要有
4.环境变量
sudo nano /etc/profile
#hbase //每个节点都要配置
export HBASE_HOME=/soft/hbase
export PATH=$PATH:$HBASE_HOME/bin
5.验证安装是否成功
$>hbase version
将hdfs-site.xml和core-site.xml复制到hbase/conf/下。
5.配置hbase模式
5.1)本地模式
[hbase/conf/hbase-env.sh]
EXPORT JAVA_HOME=/soft/jdk
[hbase/conf/hbase-site.xml]
...
<property>
<name>hbase.rootdir</name>
<value>file:/home/hadoop/HBase/HFiles</value>
</property>
5.2)伪分布式
[hbase/conf/hbase-env.sh]
EXPORT JAVA_HOME=/soft/jdk
[hbase/conf/hbase-site.xml]
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.rootdir</name>
<value>hdfs://localhost:8030/hbase</value>
</property>
5.3)完全分布式(必做)
[hbase/conf/hbase-env.sh] //也要分发
export JAVA_HOME=/soft/jdk
export HBASE_MANAGES_ZK=false
[hbse-site.xml] 分发hbase-site.xml
<!-- 使用完全分布式 -->
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<!-- 指定hbase数据在hdfs上的存放路径 -->
<property>
<name>hbase.rootdir</name>
<value>hdfs://172.20.21.100:8020/hbase</value>
</property>
<!-- 配置zk地址 -->
<property>
<name>hbase.zookeeper.quorum</name>
<value>172.20.21.100:2181,172.20.21.101:2181,172.20.21.102:2181,172.20.21.103:2181</value>
</property>
<!-- zk的本地目录 -->
<property><name>hbase.zookeeper.property.dataDir</name>
<value>/home/centos/zookeeper</value>
</property>
6.配置regionservers
[hbase/conf/regionservers] //也分发一下
s202
s203
s204
7.启动hbase集群(s201)
$>start-hbase.sh //一台机器
进入HBase命令行:hbase shell //集群中任意一台
![](https://i-blog.csdnimg.cn/blog_migrate/ae1a931a76293eac9e27c146dfe234c7.png)
8.登录hbase的webui
http://s100:16010
![](https://i-blog.csdnimg.cn/blog_migrate/72d1af1ff107caf86f4010df7f6de782.png)
二、基础架构:
![](https://i-blog.csdnimg.cn/blog_migrate/840520ecd447e738a00fe94746dbb6e5.png)
HMaster:
是HBase主/从集群架构中的中央节点;
管理RegionServer的负载均衡,调整Region分布,将Region分配给RegionServer;
管理用户对表的增删改查;
在Region分裂后,负责新Region的分配。
维护表和Region的元数据,不参与数据的输入输出过程。
Region:
HBase中存储的最小单元,HBase表格的基本单位。
RegionServer:
维护HMaster分配给他的Region,处理对这些Region的I/O请求;
负责切分正在运行过程中变得过大的Region;
ZooKeeper:当想连接HBase集群读取数据时,不需要知道HBase地址,只需要知道ZooKeeper集群地址。
ZooKeeper是集群的协调器;
HMaster启动将系统表加载到ZooKeeper;
提供HBase RegionServer状态信息;
存储HBase元数据信息、实时监控RegionServer、存储所有Region的寻址入口。