博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Hadoop2.x下安装HBase
阅读量:6341 次
发布时间:2019-06-22

本文共 4269 字,大约阅读时间需要 14 分钟。

hot3.png

环境:CentOS6.5  Hadoop2.5.2  HBase1.0.0
1.安装好 hadoop 集群,并启动
[grid@hadoop4 ~]$ sh hadoop-2.5.2/sbin/start-dfs.sh
[grid@hadoop4 ~]$ sh hadoop-2.5.2/sbin/start-yarn.sh
查看 hadoop 版本:
[grid@hadoop4 ~]$ hadoop-2.5.2/bin/hadoop version
Hadoop 2.5.2
Subversion Unknown -r Unknown
Compiled by grid on 2014-12-31T01:40Z
Compiled with protoc 2.5.0
From source with checksum df7537a4faa4658983d397abf4514320
This command was run using /home/grid/hadoop-2.5.2/share/hadoop/common/hadoop-common-2.5.2.jar
2.查看 hbase 官方文档(http://hbase.apache.org/book.html#basic.prerequisites),找到与 hadoop 版本对应的 hbase 并下载
[grid@hadoop4 ~]$ wget http://mirrors.cnnic.cn/apache/hbase/hbase-1.0.0/hbase-1.0.0-bin.tar.gz
3.解压
[grid@hadoop4 ~]$ tar -zxf hbase-1.0.0-bin.tar.gz
4.进入 hbase 的 lib 目录,查看 hadoop jar 包的版本
[grid@hadoop4 ~]$ cd hbase-1.0.0/lib/
[grid@hadoop4 lib]$ find -name 'hadoop*jar'
./hadoop-common-2.5.1.jar
./hadoop-mapreduce-client-common-2.5.1.jar
./hadoop-annotations-2.5.1.jar
./hadoop-yarn-server-common-2.5.1.jar
./hadoop-hdfs-2.5.1.jar
./hadoop-client-2.5.1.jar
./hadoop-mapreduce-client-shuffle-2.5.1.jar
./hadoop-yarn-common-2.5.1.jar
./hadoop-yarn-server-nodemanager-2.5.1.jar
./hadoop-yarn-client-2.5.1.jar
./hadoop-mapreduce-client-core-2.5.1.jar
./hadoop-auth-2.5.1.jar
./hadoop-mapreduce-client-app-2.5.1.jar
./hadoop-yarn-api-2.5.1.jar
./hadoop-mapreduce-client-jobclient-2.5.1.jar
发现与 hadoop 集群的版本号不一致,需要用 hadoop 目录下的 jar 替换 hbase/lib 目录下的 jar 文件。
编写脚本来完成替换,如下所示:
[grid@hadoop4 lib]$ pwd/home/grid/hbase-1.0.0/lib[grid@hadoop4 lib]$ vim f.shfind -name "hadoop*jar" | sed 's/2.5.1/2.5.2/g' | sed 's/\.\///g' > f.logrm ./hadoop*jarcat ./f.log | while read Linedofind /home/grid/hadoop-2.5.2 -name "$Line" | xargs -i cp {} ./donerm ./f.log[grid@hadoop4 lib]$ chmod u+x f.sh[grid@hadoop4 lib]$ ./f.sh[grid@hadoop4 lib]$ find -name 'hadoop*jar'./hadoop-yarn-api-2.5.2.jar./hadoop-mapreduce-client-app-2.5.2.jar./hadoop-common-2.5.2.jar./hadoop-mapreduce-client-jobclient-2.5.2.jar./hadoop-mapreduce-client-core-2.5.2.jar./hadoop-yarn-server-nodemanager-2.5.2.jar./hadoop-hdfs-2.5.2.jar./hadoop-yarn-common-2.5.2.jar./hadoop-mapreduce-client-shuffle-2.5.2.jar./hadoop-auth-2.5.2.jar./hadoop-mapreduce-client-common-2.5.2.jar./hadoop-yarn-client-2.5.2.jar./hadoop-annotations-2.5.2.jar./hadoop-yarn-server-common-2.5.2.jar

OK,jar 包替换成功;hbase/lib 目录下还有个 slf4j-log4j12-XXX.jar,在机器有装hadoop时,由于classpath中会有hadoop中的这个jar包,会有冲突,直接删除掉

[grid@hadoop4 lib]$ rm `find -name 'slf4j-log4j12-*jar'`

5.修改配置文件

5.1.
[grid@hadoop4 hbase-1.0.0]$ vi conf/hbase-env.sh
export JAVA_HOME=/usr/java/jdk1.7.0_72
export HBASE_CLASSPATH=/home/grid/hadoop-2.5.2/etc/hadoop
export HBASE_MANAGES_ZK=true
第一个参数指定了JDK路径;第二个参数指定了 hadoop 的配置文件路径;第三个参数设置使用 hbase 默认自带的 Zookeeper
5.2.
[grid@hadoop4 hbase-1.0.0]$ vim conf/hbase-site.xml
hbase.rootdir
hdfs://hadoop4:9000/hbase
hbase.cluster.distributed
true
hbase.tmp.dir
/home/grid/hbase-1.0.0/tmp
hbase.zookeeper.quorum
hadoop4,hadoop5,hadoop6
hbase.zookeeper.property.dataDir
/home/grid/hbase-1.0.0/zookeeper

创建目录

[grid@hadoop4 hbase-1.0.0]$ mkdir tmp
[grid@hadoop4 hbase-1.0.0]$ mkdir zookeeper
5.3.
[grid@hadoop4 hbase-1.0.0]$ vim conf/regionservers
hadoop4
hadoop5
hadoop6
6.设置环境变量
[grid@hadoop4 ~]$ vi .bash_profile
export HBASE_HOME=/home/grid/hbase-1.0.0
export PATH=$PATH:$HBASE_HOME/bin
[grid@hadoop4 ~]$ source .bash_profile
7.分发 hbase 到其它机器,并在其上设置环境变量
[grid@hadoop4 ~]$ scp -r hbase-1.0.0 grid@hadoop5:~
[grid@hadoop4 ~]$ scp -r hbase-1.0.0 grid@hadoop6:~
8.启动 hbase
[grid@hadoop4 ~]$ sh start-hbase.sh
[grid@hadoop4 ~]$ jps
2388 ResourceManager
3692 Jps
2055 NameNode
3375 HQuorumPeer
2210 SecondaryNameNode
3431 HMaster
[grid@hadoop5 ~]$ jps
2795 Jps
2580 HQuorumPeer
2656 HRegionServer
2100 NodeManager
1983 DataNode
[grid@hadoop6 ~]$ jps
2566 HQuorumPeer
1984 DataNode
2101 NodeManager
2803 Jps
2639 HRegionServer
jps查看发现 Master 机上 HRegionServer 服务未启动,查看日志显示因16020端口被占用导致 HRegionServer 启动失败,查证发现占用16020端口的是 HMaster 进程,查看官方文档后解决:[grid@hadoop4 ~]$ sh local-regionservers.sh start 2
官方文档截图:
9.shell
10.Web管理界面

转载于:https://my.oschina.net/zc741520/blog/388718

你可能感兴趣的文章
mysql主主同步+Keepalived
查看>>
研究音频编解码要看什么书
查看>>
tomcat远程调试配置
查看>>
QuartZ Cron表达式
查看>>
性能测试工具VTune的功能和用法介绍
查看>>
音频视频组件Audio DJ Studio for .NET更新至v10.0.0.0丨附下载
查看>>
RMAN Complete Recovery
查看>>
[ CodeForces 1064 B ] Equations of Mathematical Magic
查看>>
NYOJ-15:括号匹配(二)
查看>>
首次记录在案的
查看>>
C#进阶系列——WebApi 跨域问题解决方案:CORS
查看>>
你真的会玩SQL吗?让人晕头转向的三值逻辑
查看>>
Unity 脚本的未来发展
查看>>
hdu 2055 An easy problem (java)
查看>>
JQuery:JQuery捕获HTML
查看>>
js自动闭合html标签,自动补全html标记
查看>>
cpu进程调度---RT Throttling【转】
查看>>
在MapGuide 的Fusion Viewer的选择面板中显示超链接
查看>>
CentOS7下单机部署RabbltMQ环境的操作记录
查看>>
unity shader tags
查看>>