1.hbase的机群搭建过程(前是jdk、hadoop、zookeeper环境都已搭建好了)
hadoop1.1.2集群搭建参考我的博客 Hadoop1.1.2集群安装(Vmware+CenterOS6.5.X64) http://blog.csdn.net/liu_yulong/article/details/50212009
zookeeper搭建可以参考我的博客 Zookeeper学习总结 http://blog.csdn.net/liu_yulong/article/details/50218101
1.1集群结构,主节点(hmaster)是hadoop01,从节点(regionserver)是hadoop02和hadoop03
[root@hadoop01app]# cd /usr/share/app
[root@hadoop01app]# ls
hadoop-1.1.2 hbase-0.94.7-security.tar.gz zookeeper-3.4.5
[root@hadoop01app]# tar -zxvf hbase-0.94.7-security.tar.gz
[root@hadoop01app]# ls
hadoop-1.1.2 hbase-0.94.7-security hbase-0.94.7-security.tar.gz zookeeper-3.4.5
[root@hadoop01 app]# mv hbase-0.94.7-security hbase(文件夹名称太长,个人喜欢简洁,所以做了修改)
[root@hadoop01app]# cd hbase
[root@hadoop01hbase]# ls
bin CHANGES.txt conf docs hbase-0.94.7-security.jar hbase-0.94.7-security-tests.jar hbase-webapps lib LICENSE.txt NOTICE.txt pom.xml README.txt sbin security src
[root@hadoop01 conf]# echo $JAVA_HOME(修改前查看jdk安装目录,复制)
/usr/local/java/jdk1.7.0_79
1.2修改hadoop0上的hbase的几个文件
(1)修改hbase-env.sh的最后一行exportHBASE_MANAGES_ZK=false
[root@hadoop01conf]# vi hbase-env.sh
exportJAVA_HOME=/usr/local/java/jdk1.7.0_79(改为你的jdk安装目录)
export HBASE_MANAGES_ZK=false(最后一行)
(2)修改hbase-site.xml文件的hbase.zookeeper.quorum的值为hadoop01,hadoop02,hadoop03
[root@hadoop01conf]# vi hbase-site.xml
(3)修改regionservers文件(存放的region server的hostname),内容修改为hadoop02、hadoop03
[root@hadoop01conf]# vi regionservers
hadoop02
hadoop03
1.3复制hadoop0中的/etc/profile到hadoop1、hadoop2中,在hadoop02、hadoop03上执行source/etc/profile
[root@hadoop01conf]# cd ..
[root@hadoop01hbase]# pwd
/usr/share/app/hbase
[root@hadoop01hbase]# vi /etc/profile
export HBASE_HOME=/usr/share/app/hbase
exportPATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/lib:$ZOOKEEPER_HOME/bin:$HBASE_HOME/bin
[root@hadoop01hbase]# source /etc/profile
[root@hadoop01hbase]# scp -r /etc/profile hadoop02:/etc/
[root@hadoop01 hbase]# scp -r /etc/profile hadoop03:/etc/
[root@hadoop02app]# source /etc/profile
[root@hadoop03 app]#source /etc/profile
复制hadoop0中的hbase文件夹到hadoop02、hadoop03中
[root@hadoop01hbase]# scp -r /usr/share/app/hbase hadoop02:/usr/share/app/
[root@hadoop01 hbase]# scp -r /usr/share/app/hbase hadoop03:/usr/share/app/
1.4 首先启动hadoop,然后启动zookeeper集群。
最后在hadoop01上启动hbase集群,然后jps查看进程。
[root@hadoop01hbase]# start-hbase.sh
startingmaster, logging to /usr/share/app/hbase/logs/hbase-root-master-hadoop01.out
hadoop03:starting regionserver, logging to/usr/share/app/hbase/bin/../logs/hbase-root-regionserver-hadoop03.out
hadoop02:starting regionserver, logging to/usr/share/app/hbase/bin/../logs/hbase-root-regionserver-hadoop02.out
[root@hadoop01hbase]# jps
1271NameNode
2640Jps
2463 HMaster
1395SecondaryNameNode
1470JobTracker
1637QuorumPeerMain
[root@hadoop02app]# jps
2423Jps
2324 HRegionServer
1396QuorumPeerMain
1276TaskTracker
1225DataNode
[root@hadoop03app]# jps
1415QuorumPeerMain
1738 HRegionServer
1224DataNode
1275TaskTracker
1861Jps
OK!Hbase集群搭建成功!
此博客只做交流使用,有不足之处,欢迎交流指正!