[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管理界面