一、安装环境
hadoop版本:3.1.2
hbase版本:hbase-2.0.5
系统类型:ubuntu-server-16.04 3台
jdk版本:1.8
二、安装过程
1、解压安装文件并移动到要安装目录
tar -zxvf hbase-2.0.5-bin.tar.gz
sudo mv hbase-2.0.5 /usr/local/hadoop/hbase-2.0.5
给hadoop安装目录设置用户操作权限
sudo chown -R hadoop:hadoop /usr/local/hadoop/hbase-2.0.5
2、配置环境变量
export HBASE_HOME=/usr/local/hadoop/hbase-2.0.5
export PATH=$HBASE_HOME/bin:$PATH
3、配置hbase-env.sh
cd /usr/local/hadoop/hbase-2.0.5/conf
vim hbase-env.sh
export JAVA_HOME=/usr/local/jdk1.8
export HBASE_CLASSPATH=$HBASE_CLASSPATH:/usr/local/hadoop/hadoop-3.1.2/etc/hadoop
#关闭自身zookeeper,采用外部的zookeeper
export HBASE_MANAGES_ZK=false
4、配置hbase-site.xml
cd /usr/local/hadoop/hbase-2.0.5/conf
vim hbase-site.xml
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://ns1/hbase</value>
<description>hadoop集群名称</description>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>hadoop-master,hadoop-slave0,hadoop-slave1</value>
<description>zookeeper集群</description>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
<description>是否是完全分布式</description>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
<property>
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
<description>完全分布式式必须为false</description>
</property>
<property>
<name>hbase.tmp.dir</name>
<value>/usr/local/hadoop/data/hbase/tmp</value>
</property>
<property>
<name>hbase.master</name>
<value>60000</value>
</property>
</configuration>
5、配置regionservers
cd /usr/local/hadoop/hbase-2.0.5/conf
vim regionservers
hadoop-slave0
hadoop-slave1
6、配置backup-masters
/usr/local/hadoop/hbase-2.0.5/conf下创建backup-masters文件
配置备份主节点:hadoop-slave0
7、从主节点同步hbase到其它节点
scp -r /usr/local/hadoop/hbase-2.0.5 hadoop-slave0:/usr/local/hadoop/hbase-2.0.5
scp -r /usr/local/hadoop/hbase-2.0.5 hadoop-slave1:/usr/local/hadoop/hbase-2.0.5
8、启动hbase
start-hbase.sh
在某regionserver上启动Hmaster,这里是hadoop-slave0节点
hbase-daemon.sh start master
其它启动停止Hmaster和Hregionserver命令
hbase-daemon.sh stop master
hbase-daemons.sh start regionserver
hbase-daemons.sh stop regionserver
注意:
hbase中的slf4j-log4j12-1.7.25.jar和hadoop中的有冲突,删除hbase的lib下的slf4j-log4j12-1.7.25.jar