HBase安装指南
HBase是基于Hadoop的开源分布式数据库,它以Google的BigTable为原型,设计并实现了具有高可靠性、高性能、列存储、可伸缩、实时读写的分布式数据库系统。HBase需要ZooKeeper集群服务,默认情况下,它管理一个ZooKeeper实例,作为“权威机构”。因此安装HBase,首先需要部署ZooKeeper。
安装ZooKeeper
下载并解压ZooKeeper
tar -zxvf apache-zookeeper-3.5.5-bin.tar.gz mkdir -p /opt/zookeeper/data mv apache-zookeeper-3.5.5-bin/* /opt/zookeeper/ chown -R hadoop:hadoop /opt/zookeeper
配置数据存储目录和集群地址
cd /opt/zookeeper/conf cp zoo_sample.cfg zoo.cfg vi zoo.cfg
- dataDir=/opt/zookeeper/data
- server.1=hbase-master01.swufefic.com:2888:3888
- server.2=hbase-slave01.swufefic.com:2888:3888
- server.3=hbase-slave02.swufefic.com:2888:3888
配置环境变量
export ZOOKEEPER_HOME=/opt/zookeeper export PATH=$PATH:$ZOOKEEPER_HOME/bin
远程拷贝ZooKeeper
scp -r zookeeper/ hadoop@hbase-slave01.swufefic.com:/opt/ scp .bashrc hadoop@hbase-slave01.swufefic.com:~/
新建并填写myid文件
cd /opt/zookeeper/data touch myid echo "1" >> myid
启动ZooKeeper集群
zkServer.sh start
安装HBase
下载并解压HBase
tar -zxvf hbase-2.2.0-bin.tar.gz mv hbase-2.2.0/* /opt/hbase/
配置环境变量
export HBASE_HOME=/opt/hbase export PATH=$PATH:$HBASE_HOME/bin
配置
hbase-env.sh
export JAVA_HOME=/usr/java/default export JAVA_CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export HBASE_MANAGES_ZK=false
配置
hbase-site.xml
HMaster
<configuration> <property> <name>hbase.rootdir</name> <value>hdfs://hbase-master01.swufefic.com:9000/user/hbase</value> </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> </property> <property> <name>hbase.zookeeper.property.dataDir</name> <value>/opt/zookeeper/data</value> </property> <property> <name>hbase.zookeeper.quorum</name> <value>hbase-master01.swufefic.com,hbase-slave01.swufefic.com,hbase-slave02.swufefic.com</value> </property> <property> <name>hbase.zookeeper.property.clientPort</name> <value>2181</value> </property> <property> <name>hbase.unsafe.stream.capability.enforce</name> <value>false</value> </property> </configuration>
HRegionServer
<configuration> <property> <name>hbase.rootdir</name> <value>hdfs://hbase-master01.swufefic.com:9000/user/hbase</value> </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> </property> </configuration>
编辑regionservers文件
[hadoop@hbase-master01 conf]$ cat regionservers hbase-slave01.swufefic.com hbase-slave02.swufefic.com
运行HBase
start-all.sh # HDFS zkServer.sh start # ZooKeeper start-hbase.sh # HBase