如何为64位Linux机器编译Hadoop?

时间:2013-12-28 15:40:36

标签: java maven hadoop compilation maven-2

我已经下载了最新的Hadoop稳定二进制文件(2.2.0)。就像我初始化HDFS一样,我收到了这个警告:

  

WARN util.NativeCodeLoader:无法加载native-hadoop库   您的平台......在适用的情况下使用builtin-java类

我知道我可以通过从源代码编译来解决这个问题,所以我从Hadoop下载了源代码包。我知道编译的基本过程,但在阅读README后感到困惑。一个快速的谷歌表明,我必须使用maven,这是一个建立基于Java的项目的工具。

所以我的问题是,如何使用maven从源代码编译Hadoop?我应该进入每个目录并编译每个模块吗?分步指南非常有用,我们将非常感谢解释。

2 个答案:

答案 0 :(得分:2)

提取源后,您会在下方找到一个超级pom。 \ Hadoop的2.2.0-src.tar \的hadoop-2.2.0-SRC \的hadoop-2.2.0-SRC \的pom.xml 这将构建所有模块。 您可以使用命令构建:mvn clean install

你应该注意到如下的日志。

            [INFO] ------------------------------------------------------------------------
            [INFO] Reactor Build Order:
            [INFO]
            [INFO] Apache Hadoop Main
            [INFO] Apache Hadoop Project POM
            [INFO] Apache Hadoop Annotations
            [INFO] Apache Hadoop Project Dist POM
            [INFO] Apache Hadoop Assemblies
            [INFO] Apache Hadoop Maven Plugins
            [INFO] Apache Hadoop Auth
            [INFO] Apache Hadoop Auth Examples
            [INFO] Apache Hadoop Common
            [INFO] Apache Hadoop NFS
            [INFO] Apache Hadoop Common Project
            [INFO] Apache Hadoop HDFS
            [INFO] Apache Hadoop HttpFS
            [INFO] Apache Hadoop HDFS BookKeeper Journal
            [INFO] Apache Hadoop HDFS-NFS
            [INFO] Apache Hadoop HDFS Project
            [INFO] hadoop-yarn
            [INFO] hadoop-yarn-api
            [INFO] hadoop-yarn-common
            [INFO] hadoop-yarn-server
            [INFO] hadoop-yarn-server-common
            [INFO] hadoop-yarn-server-nodemanager
            [INFO] hadoop-yarn-server-web-proxy
            [INFO] hadoop-yarn-server-resourcemanager
            [INFO] hadoop-yarn-server-tests
            [INFO] hadoop-yarn-client
            [INFO] hadoop-yarn-applications
            [INFO] hadoop-yarn-applications-distributedshell
            [INFO] hadoop-mapreduce-client
            [INFO] hadoop-mapreduce-client-core
            [INFO] hadoop-yarn-applications-unmanaged-am-launcher
            [INFO] hadoop-yarn-site
            [INFO] hadoop-yarn-project
            [INFO] hadoop-mapreduce-client-common
            [INFO] hadoop-mapreduce-client-shuffle
            [INFO] hadoop-mapreduce-client-app
            [INFO] hadoop-mapreduce-client-hs
            [INFO] hadoop-mapreduce-client-jobclient
            [INFO] hadoop-mapreduce-client-hs-plugins
            [INFO] Apache Hadoop MapReduce Examples
            [INFO] hadoop-mapreduce

以及更多......

但是,如果您只想使用Hadoop,这是一个长途旅行的方法。 您应该能够使用现有的库。 可能是一些配置问题。

其他选择是Cloudera。我在RedHat Linux上安装了它。

http://www.cloudera.com/content/cloudera-content/cloudera-docs/CDH4/latest/CDH4-Quick-Start/cdh4qs_topic_3.html

祝你好运。

答案 1 :(得分:1)

考虑使用Apache Bigtop构建Hadoop。

这是恕我直言自己编译Hadoop最方便的方式,只要你只需要“mainsteam”组件和稳定版本。