通过tarball形式安装HBASE Cluster(CDH5.0.2)——重新编译CDH5.0.2 HADOOP点滴

本文参考博文Hadoop2.2.0遇到64位操作系统平台报错,重新编译Hadoop

由于我采用的tarball方式安装hadoop,其lib/native下根本没有内容,启动hdfs时报这个经典的native 库转载失败警告

WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

 所以,需要重新编译hadoop项目。

 

注意我的系统是CentOS 6.5  CDH5.0.2 ,需要下载maven3.1.1版本

一、下载maven 3.1.1并展开

#下载maven tar包
wget http://apache.fayea.com/apache-mirror/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz #展开到/usr/lib目录 tar -C /usr/lib -zxvf apache-maven-3.0.5-bin.tar.gz
#在usr下面建立软链接
cd /usr
sudo ln -s /usr/lib/apache-maven-3.1.1/ maven
#编辑/etc/profile
sudo vim /etc/profile
#添加如下变量
export MAVEN_HOME=/usr/maven
PATH=$PATH:$MAVEN_HOME/bin

 

二、编译Hadoop

mvn package -DskipTests -Pdist,native -Dtar

 maven需要下载一大堆文件,网络必须畅通。开始一切顺利,当编译到hadoop-common的时候总是Error,编译过不去,我确信需要的包都已安装了,于是我进入hadoop-common-project子目录,单独编译这个子项目,发现如下错误:

CMake Error: The current CMakeCache.txt directory /var/hadoop/hadoop-2.3.0-cdh5.0.2/src/hadoop-common-project/hadoop-common/target/native/CMakeCache.txt is different than the directory 
/usr/hadoop/hadoop-2.3.0-cdh5.0.2/src/hadoop-common-project/hadoop-common/target/native where CMackeCache.txt was created. This may result in binaries being created in the wrong place.
If you are not sure, reedit the CMakeCache.txt

 看来是以前编译残留文件不一致导致的,于是我清除编译缓存,重新编译,终于编译成功了,见到了久违的BUILD SUCCESS

mvn clean -DskipTests
mvn compile -DskipTests
mvn package -DskipTests -Dtar -Pdist,native
##BUILD SUCCESS

##COPY native libraries to the lib/native directory
cp ~/hadoop/src/hadoop-dist/lib/native/* ~/hadoop/lib/native
start-dfs.sh

编译完成后,复制src/hadoop-dist/lib/native中的文件到~/hadoop/lib/native目录下,重新启动dfs集群,ok警告没有了,问题解决。

posted @ 2014-07-15 11:06  柒零壹  阅读(794)  评论(0编辑  收藏  举报