HBase安装需要依赖Hadoop和Zookeeper两大组件。
因此,安装HBase前,默认Hadoop和Zookeeper两大组件已经安装完毕。
一、上传并解压`hbase-1.3.1-bin.tar`包到`/opt/`目录下
二、修改配置`hbase-env.sh`
```bash
export JAVA_HOME=/opt/java
```
```bash
注释掉
# Configure PermSize. Only needed in JDK7. You can safely remove it for JDK8+
export HBASE_MASTER_OPTS="$HBASE_MASTER_OPTS -XX:PermSize=128m -XX:MaxPermSize=128m"
export HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS -XX:PermSize=128m -XX:MaxPermSize=128m"
```
```bash
export HBASE_MANAGES_ZK=false
```
三、修改配置`hbase-site.xml`
```xml
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://hadoop1:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.master.port</name>
<value>16000</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>hadoop1:2181,hadoop2:2181,hadoop3:2181</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/opt/zookeeper/data</value>
</property>
</configuration>
```
四、修改配置`regionservers`
```
hadoop1
hadoop2
hadoop3
```
五、复制配置
```bash
cp /opt/hadoop/etc/hadoop/hdfs-site.xml /opt/hbase/conf/
cp /opt/hadoop/etc/hadoop/core-site.xml /opt/hbase/conf/
```
六、安装包分发
```bash
scp -r /opt/hbase/ root@hadoop2:/opt/
scp -r /opt/hbase/ root@hadoop3:/opt/
```
七、启动
```bash
/opt/hbase/bin/start-hbase.sh
```
单独启动
```bash
/opt/hbase/bin/hbase-daemon.sh start master
/opt/hbase/bin/hbase-daemon.sh start regionserver
```