1.前提
Hadoop分布式环境已安装,见 http://blog.csdn.net/yyl424525/article/details/55097022
Zookeeper分布式环境已安装,见 http://blog.csdn.net/yyl424525/article/details/77454084
2.安装和配置hbase
2.1 上传hbase-1.2.6-bin.tar.gz安装包
tar -zxvf /usr/local/hbase-1.2.6-bin.tar.gz -C /usr/local/yyl
mkdir /usr/local/yyl/hbase-1.2.6/logs
2.2 配置hbase环境变量
vi /etc/profile
export HBASE_HOME=/usr/local/yyl/hbase-1.2.6
export PATH=$PATH:$HBASE_HOME/bin
-------------------------------------------------------
更多配置:
export JAVA_HOME=/usr/local/yyl/jdk1.8
export HADOOP_HOME=/usr/local/yyl/hadoop-2.6.5
export HBASE_HOME=/usr/local/yyl/hbase-1.2.6
export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$HBASE_HOME/bin
source /etc/profile
2.3 修改hbase-env.sh
vi /usr/local/yyl/hbase-1.2.6/conf/hbase-env.sh
配置内容(可加在末尾):
export JAVA_HOME=/usr/local/yyl/jdk1.8
export HBASE_LOG_DIR=${HBASE_HOME}/logs
export HBASE_MANAGES_ZK=false #不使用HBase自带的zookeeper实例
2.4 修改regionservers
vi /usr/local/yyl/hbase-1.2.6/conf/regionservers
配置内容:
删除:localhost
添加:
hdp-node-02
hdp-node-03
2.5 修改hbase-site.xml
vi /usr/local/yyl/hbase-1.2.6/conf/hbase-site.xml
配置内容:
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://hdp-node-01:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>hdp-node-01,hdp-node-02,hdp-node-03</value>
</property>
<property>
<name>hbase.master</name>
<value>hdfs://hdp-node-01:60000</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/usr/local/yyl/zookeeper-3.4.6/data/zkdata</value>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
</configuration>
注:
1.Hbase的Master的端口.
默认: 60000
2.hbase.cluster.distributed为true表示全分布式
3.hbase.zookeeper.property.clientPort:2181要与zookeeper中的一致
4.hbase.zookeeper.quorum 的个数须是奇数
3.各个主机之间复制hbase
scp -r /usr/local/yyl/hbase-1.2.6/ hdp-node-02:/usr/local/yyl
4.启动hbase
4.1 启动之前先启动hadoop
start-all.sh
4.2 启动zookeeper集群
进入到zk安装目录下的bin目录,启动zookeeper集群
/usr/local/yyl/zookeeper-3.4.6/bin/
./zkServer.sh start (3台都需要)
检查服务状态:
./zkServer.sh status
停止:zkServer.sh stop
4.3 启动hbase:(只需在主节点启动)
cd /usr/hbase-1.2.1/bin
./start-hbase.sh
关闭:
stop-hbase.sh
/usr/local/yyl/hbase-1.2.6/bin/stop-hbase.sh
强行关闭
/usr/local/yyl/hbase-1.2.6/bin/hbase-daemon.sh start master
/usr/local/yyl/hbase-1.2.6/bin/hbase-daemon.sh start regionserver
4.4 查看进程
master主机包含ResourceManager、SecondaryNameNode、NameNode、HQuorumPeer、HMaster等,则表示启动成功,例如
2212 ResourceManager
2999 Jps
2697 HQuorumPeer
1917 NameNode
2078 SecondaryNameNode
2751 HMaster
各个slave主机包含
DataNode、NodeManager、HRegionServer、HQuorumPeer等,则表示启用成功,例如
17540 Jps
17142 NodeManager
17338 HRegionServer
17278 HQuorumPeer
17055 DataNode