实验准备:
主机名 | IP地址 | 安装服务 | 备注 |
---|---|---|---|
hadoop-01 | 192.168.200.201 | jdk1.8, zookeeper3.4.8,hadoop2.7.7,ntpd | 主节点 |
hadoop-02 | 192.168.200.202 | jdk1.8,zookeeper3.4.8,hadoop2.7.7,ntpd | 备用主节点 |
hadoop-03 | 192.168.200.203 | jdk1.8,zookeeper3.4.8,hadoop2.7.7,ntpd | 服务节点 |
启动顺序:
- zookeeper集群
- hadoop集群
- hbase集群
下载所需Hbase压缩包
实验版本:1.2.4
上传压缩包,接着解压压缩包
# tar -zxvf 文件名
配置环境变量
# vi /etc/profile
添加 hbase_home和path:
export HBASE_HOME=/root/software/hbase-1.2.4
export PATH=$PATH:$HBASE_HOME/bin
生效环境变量:
# source /etc/profile
检测 # hbase version
[root@hadoop-02 hbase-1.2.4]# hbase version
HBase 1.2.4 Source code repository git://asf-dev/home/busbey/projects/hbase revision=67592f3d062743907f8c5ae00dbbe1ae4f69e5af Compiled by busbey on Tue Oct 25 18:10:20 CDT 2016 From source with checksum b45f19b5ac28d9651aa2433a5fa33aa0
配置Hbase配置文件
配置 ${HBASE_HOME}/conf/hbase-env.sh
export JAVA_HOME=/root/software/jdk1.8.0_251
export HADOOP_HOME=/root/software/hadoop-2.7.7 #配置hadoop变量,否则hbase不识别hdfs集群名
export HBASE_HOME=/root/software/hbase-1.2.4
export HBASE_LOG_DIR=${HBASE_HOME}/logs
export HBASE_MANAGES_ZK=fales #不使用hbase自带的zookeeper,使用搭建的zk集群。
export HBASE_CLASSPATH=${HBASE_HOME}/conf
配置 ${HBASE_HOME}/conf/hbase-site.xml
<configuration>
<!-- 指定hbase在hdfs上的目录,没有会自动创建 -->
<!-- 因为hadoop是高可用,所以hbase.rootdir的地址必须和hadoop的配置文件core-site.xml下的fs.Defalut一样-->
<property>
<name>hbase.rootdir</name>
<value>hdfs://ns1/hbase</value>
</property>
<!-- 指定hbase是分布式的,否则会工作在单机模式 -->
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.master</name>
<value>hdfs://host1:60000</value>
</property>
<!-- 指定zk的地址,多个用“,”分割 -->
<property>
<name>hbase.zookeeper.quorum</name>
<value>hadoop-01,hadoop-02,hadoop-03</value>
<description>Comma separated list of servers in the ZooKeeper Quorum. For example, "host1.mydomain.com,host2.mydomain.com,host3.mydomain.com". By default this is set to localhost for local and pseudo-distributed modes of operation. For a fully-distributed setup, this should be set to a full list of ZooKeeper quorum servers. If HBASE_MANAGES_ZK is set in hbase-env.sh this is the list of servers which we will start/stop ZooKeeper on. </description>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/root/zkDataDir/zookeeper</value>
<description>Property from ZooKeeper's config zoo.cfg. The directory where the snapshot is stored. </description>
</property>
</configuration>
分发Hbase文件
# scp -r hadoop-01上hbase的文件夹路径 hadoop-02:/目标路径
# scp -r hadoop-01上hbase的文件夹路径 hadoop-03:/目标路径
分别配置环境变量,参考上文,生效后一定要检测
测试
开启zookeeper集群
开启zookeeper集群
#start-hbase.sh (hadoop-01)
#hbase-daemon.sh start master (hadoop-02)
网页检测:
问题解决
看进程都有无:
[root@hadoop-01 ~]# jps
2369 QuorumPeerMain
11617 HRegionServer #hbase进程
7300 JournalNode
7509 DFSZKFailoverController
12613 Jps
7751 NodeManager
6970 NameNode
11467 HMaster #hbase
7084 DataNode
7631 ResourceManager
[root@hadoop-02 ~]# jps
8993 Jps
4997 JournalNode
7349 HRegionServer #hbase进程
7606 HMaster #hbase
5223 NodeManager
2364 QuorumPeerMain
5133 DFSZKFailoverController
4815 NameNode
4895 DataNode
[root@hadoop-03 ~]# jps
5920 Jps
3763 DataNode
3971 NodeManager
2342 QuorumPeerMain
3865 JournalNode
5481 HRegionServer #hbase进程
如果只有hadoop-01有hbase相关进程,检测时间是否同步
如果只有hadoop-01有hbase相关进程,检测时间是否同步
如果还未解决,请查看Hbase启动日志。