`
qindongliang1922
  • 浏览: 2188684 次
  • 性别: Icon_minigender_1
  • 来自: 北京
博客专栏
7265517b-f87e-3137-b62c-5c6e30e26109
证道Lucene4
浏览量:117664
097be4a0-491e-39c0-89ff-3456fadf8262
证道Hadoop
浏览量:126072
41c37529-f6d8-32e4-8563-3b42b2712a50
证道shell编程
浏览量:60032
43832365-bc15-3f5d-b3cd-c9161722a70c
ELK修真
浏览量:71400
社区版块
存档分类
最新评论

如何在CentOS6.5下编译64位的Hadoop2.x

阅读更多
hadoop2.x在apache官网直接下载的并没有64位直接能用的版本,如果我们想在64位系统使用,那么就需要重新编译hadoop,否则直接使用32位的hadoop运行在64位的系统上,将会出现一些库不兼容的异常。如下图所示,最直接的一个异常:



在这之前,散仙先用一个表格来描述下散仙的编译的环境的状况:
序号描述备注
1centos6.5系统64位linux环境
2Apache Ant1.9ant编译
3Apache Maven3.2.1maven打包部署
4gcc,gcc-c++,make依赖库
5protobuf-2.5.0序列化库
6JDK1.7JAVA 环境
7Hadoop2.2.0源码包官网下载
8屌丝工程师一名主角
9hadoop交流群376932160技术交流





下面进入正题,散仙的环境是在centos下,所以大部分安装编译依赖库,都可以很方便的使用yum命令来完成。

1,安装gcc,执行如下的几个yum命令即可



yum -y install gcc
yum install -y  bzip2-devel
yum -y install gcc-c++
yum install make
yum install autoconf automake libtool cmake ncurses-devel openssl-devel gcc*


2,安装JDK,并设置环境变量,完成后测试安装成功否
[root@ganglia ~]# java -version
java version "1.5.0"
gij (GNU libgcj) version 4.4.7 20120313 (Red Hat 4.4.7-4)

Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@ganglia ~]# 

3, 安装Maven,安装完成后测试安装与否
[root@ganglia ~]# mvn -v
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-15T01:37:52+08:00)
Maven home: /usr/local/maven
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: /usr/local/jdk1.7.0_25/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-431.el6.x86_64", arch: "amd64", family: "unix"
[root@ganglia ~]# 

4, 安装Ant, 安装完成后,依旧测试成功与否
[root@ganglia ~]# ant -version
Apache Ant(TM) version 1.9.4 compiled on April 29 2014
[root@ganglia ~]# 

5,安装protobuf,安装方式,从官网下载tar.gz的包点击下载,并上传到linux上解压,然后进入根目录下,执行如下的几个命令:
wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.bz2

./configure 
make 
make check
make install

然后,执行如下命令,进行测试安装成功与否
[root@ganglia protobuf-2.5.0]# protoc
Missing input file.
[root@ganglia protobuf-2.5.0]# 


6,从hadoop官网下载hadoop2.2.0的版本的源码的src的包,并查看目录
[root@ganglia ~]# cd hadoop-2.2.0-src
[root@ganglia hadoop-2.2.0-src]# ll
总用量 108
-rw-r--r--.  1 67974 users  9968 10月  7 2013 BUILDING.txt
drwxr-xr-x.  2 67974 users  4096 10月  7 2013 dev-support
drwxr-xr-x.  4 67974 users  4096 6月   9 17:05 hadoop-assemblies
drwxr-xr-x.  3 67974 users  4096 6月   9 17:27 hadoop-client
drwxr-xr-x.  9 67974 users  4096 6月   9 17:14 hadoop-common-project
drwxr-xr-x.  3 67974 users  4096 6月   9 17:26 hadoop-dist
drwxr-xr-x.  7 67974 users  4096 6月   9 17:20 hadoop-hdfs-project
drwxr-xr-x. 11 67974 users  4096 6月   9 17:25 hadoop-mapreduce-project
drwxr-xr-x.  4 67974 users  4096 6月   9 17:06 hadoop-maven-plugins
drwxr-xr-x.  3 67974 users  4096 6月   9 17:27 hadoop-minicluster
drwxr-xr-x.  4 67974 users  4096 6月   9 17:03 hadoop-project
drwxr-xr-x.  3 67974 users  4096 6月   9 17:05 hadoop-project-dist
drwxr-xr-x. 12 67974 users  4096 6月   9 17:26 hadoop-tools
drwxr-xr-x.  4 67974 users  4096 6月   9 17:24 hadoop-yarn-project
-rw-r--r--.  1 67974 users 15164 10月  7 2013 LICENSE.txt
-rw-r--r--.  1 67974 users   101 10月  7 2013 NOTICE.txt
-rw-r--r--.  1 67974 users 16569 10月  7 2013 pom.xml
-rw-r--r--.  1 67974 users  1366 10月  7 2013 README.txt
[root@ganglia hadoop-2.2.0-src]# 


7,修改/root/hadoop-2.2.0-src/hadoop-common-project/hadoop-auth/pom.xml文件,增加,补丁内容,这部分是hadoop2.2.0的bug,如果是其他的2.x的版本,可以视情况而定,内容如下:
  <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-all</artifactId>
      <scope>test</scope>
    </dependency>
	<!--新增的内容开始 -->
	<dependency>
		<groupId>org.mortbay.jetty</groupId>
		    <artifactId>jetty-util</artifactId>
		    <scope>test</scope>
	</dependency>
	<!--新增的内容结束 -->
    <dependency>
      <groupId>org.mortbay.jetty</groupId>
      <artifactId>jetty</artifactId>
      <scope>test</scope>
    </dependency>


8,修改完毕后,回到hadoop-2.2.0-src的跟目录下执行编译打包命令:
mvn clean
mvn package -Pdist,native -DskipTests -Dtar

然后等待半个小时左右的编译时间,网速快的话,时间可能会更短,编译完成后,输出的打包信息如下:
[INFO] 
[INFO] --- maven-resources-plugin:2.2:resources (default-resources) @ hadoop-minicluster ---
[INFO] Using default encoding to copy filtered resources.
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ hadoop-minicluster ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-resources-plugin:2.2:testResources (default-testResources) @ hadoop-minicluster ---
[INFO] Using default encoding to copy filtered resources.
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ hadoop-minicluster ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.3:test (default-test) @ hadoop-minicluster ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ hadoop-minicluster ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: /root/hadoop-2.2.0-src/hadoop-minicluster/target/hadoop-minicluster-2.2.0.jar
[INFO] 
[INFO] --- maven-source-plugin:2.1.2:jar-no-fork (hadoop-java-sources) @ hadoop-minicluster ---
[INFO] No sources in project. Archive not created.
[INFO] 
[INFO] --- maven-source-plugin:2.1.2:test-jar-no-fork (hadoop-java-sources) @ hadoop-minicluster ---
[INFO] No sources in project. Archive not created.
[INFO] 
[INFO] --- maven-site-plugin:3.0:attach-descriptor (attach-descriptor) @ hadoop-minicluster ---
[INFO] 
[INFO] --- maven-javadoc-plugin:2.8.1:jar (module-javadocs) @ hadoop-minicluster ---
[INFO] Building jar: /root/hadoop-2.2.0-src/hadoop-minicluster/target/hadoop-minicluster-2.2.0-javadoc.jar
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Apache Hadoop Main ................................ SUCCESS [01:43 min]
[INFO] Apache Hadoop Project POM ......................... SUCCESS [01:21 min]
[INFO] Apache Hadoop Annotations ......................... SUCCESS [ 42.256 s]
[INFO] Apache Hadoop Assemblies .......................... SUCCESS [  0.291 s]
[INFO] Apache Hadoop Project Dist POM .................... SUCCESS [ 41.053 s]
[INFO] Apache Hadoop Maven Plugins ....................... SUCCESS [ 44.283 s]
[INFO] Apache Hadoop Auth ................................ SUCCESS [01:49 min]
[INFO] Apache Hadoop Auth Examples ....................... SUCCESS [ 18.950 s]
[INFO] Apache Hadoop Common .............................. SUCCESS [05:31 min]
[INFO] Apache Hadoop NFS ................................. SUCCESS [ 40.498 s]
[INFO] Apache Hadoop Common Project ...................... SUCCESS [  0.050 s]
[INFO] Apache Hadoop HDFS ................................ SUCCESS [03:43 min]
[INFO] Apache Hadoop HttpFS .............................. SUCCESS [ 26.962 s]
[INFO] Apache Hadoop HDFS BookKeeper Journal ............. SUCCESS [ 47.056 s]
[INFO] Apache Hadoop HDFS-NFS ............................ SUCCESS [  4.237 s]
[INFO] Apache Hadoop HDFS Project ........................ SUCCESS [  0.029 s]
[INFO] hadoop-yarn ....................................... SUCCESS [01:25 min]
[INFO] hadoop-yarn-api ................................... SUCCESS [ 40.841 s]
[INFO] hadoop-yarn-common ................................ SUCCESS [ 31.228 s]
[INFO] hadoop-yarn-server ................................ SUCCESS [  0.161 s]
[INFO] hadoop-yarn-server-common ......................... SUCCESS [ 12.289 s]
[INFO] hadoop-yarn-server-nodemanager .................... SUCCESS [ 19.271 s]
[INFO] hadoop-yarn-server-web-proxy ...................... SUCCESS [  3.586 s]
[INFO] hadoop-yarn-server-resourcemanager ................ SUCCESS [ 14.674 s]
[INFO] hadoop-yarn-server-tests .......................... SUCCESS [  1.153 s]
[INFO] hadoop-yarn-client ................................ SUCCESS [  7.861 s]
[INFO] hadoop-yarn-applications .......................... SUCCESS [  0.106 s]
[INFO] hadoop-yarn-applications-distributedshell ......... SUCCESS [  4.540 s]
[INFO] hadoop-mapreduce-client ........................... SUCCESS [  0.168 s]
[INFO] hadoop-mapreduce-client-core ...................... SUCCESS [ 29.360 s]
[INFO] hadoop-yarn-applications-unmanaged-am-launcher .... SUCCESS [  3.353 s]
[INFO] hadoop-yarn-site .................................. SUCCESS [  0.128 s]
[INFO] hadoop-yarn-project ............................... SUCCESS [ 29.610 s]
[INFO] hadoop-mapreduce-client-common .................... SUCCESS [ 19.908 s]
[INFO] hadoop-mapreduce-client-shuffle ................... SUCCESS [  3.357 s]
[INFO] hadoop-mapreduce-client-app ....................... SUCCESS [ 12.116 s]
[INFO] hadoop-mapreduce-client-hs ........................ SUCCESS [  5.807 s]
[INFO] hadoop-mapreduce-client-jobclient ................. SUCCESS [  6.713 s]
[INFO] hadoop-mapreduce-client-hs-plugins ................ SUCCESS [  2.001 s]
[INFO] Apache Hadoop MapReduce Examples .................. SUCCESS [  7.684 s]
[INFO] hadoop-mapreduce .................................. SUCCESS [  3.664 s]
[INFO] Apache Hadoop MapReduce Streaming ................. SUCCESS [  5.645 s]
[INFO] Apache Hadoop Distributed Copy .................... SUCCESS [ 29.953 s]
[INFO] Apache Hadoop Archives ............................ SUCCESS [  2.277 s]
[INFO] Apache Hadoop Rumen ............................... SUCCESS [  7.743 s]
[INFO] Apache Hadoop Gridmix ............................. SUCCESS [  5.608 s]
[INFO] Apache Hadoop Data Join ........................... SUCCESS [  3.385 s]
[INFO] Apache Hadoop Extras .............................. SUCCESS [  3.509 s]
[INFO] Apache Hadoop Pipes ............................... SUCCESS [  8.266 s]
[INFO] Apache Hadoop Tools Dist .......................... SUCCESS [  2.073 s]
[INFO] Apache Hadoop Tools ............................... SUCCESS [  0.025 s]
[INFO] Apache Hadoop Distribution ........................ SUCCESS [ 23.928 s]
[INFO] Apache Hadoop Client .............................. SUCCESS [  6.876 s]
[INFO] Apache Hadoop Mini-Cluster ........................ SUCCESS [  0.514 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 26:04 min
[INFO] Finished at: 2014-06-09T17:27:26+08:00
[INFO] Final Memory: 96M/239M
[INFO] ------------------------------------------------------------------------


编译好的hadoop包,路径在:
[root@ganglia target]# pwd
/root/hadoop-2.2.0-src/hadoop-dist/target
[root@ganglia target]# ll
总用量 282348
drwxr-xr-x. 2 root root      4096 6月   9 17:26 antrun
-rw-r--r--. 1 root root      1618 6月   9 17:26 dist-layout-stitching.sh
-rw-r--r--. 1 root root       635 6月   9 17:26 dist-tar-stitching.sh
drwxr-xr-x. 9 root root      4096 6月   9 17:26 hadoop-2.2.0
-rw-r--r--. 1 root root  96183833 6月   9 17:27 hadoop-2.2.0.tar.gz
-rw-r--r--. 1 root root      2745 6月   9 17:26 hadoop-dist-2.2.0.jar
-rw-r--r--. 1 root root 192903472 6月   9 17:27 hadoop-dist-2.2.0-javadoc.jar
drwxr-xr-x. 2 root root      4096 6月   9 17:27 javadoc-bundle-options
drwxr-xr-x. 2 root root      4096 6月   9 17:26 maven-archiver
drwxr-xr-x. 2 root root      4096 6月   9 17:26 test-dir
[root@ganglia target]# 

编译完成后的本地库,位于如下位置,并查看本地库支持位数:
[root@ganglia native]# pwd
/root/hadoop-2.2.0-src/hadoop-dist/target/hadoop-2.2.0/lib/native
[root@ganglia native]# ll
总用量 3596
-rw-r--r--. 1 root root  733114 6月   9 17:26 libhadoop.a
-rw-r--r--. 1 root root 1487236 6月   9 17:26 libhadooppipes.a
lrwxrwxrwx. 1 root root      18 6月   9 17:26 libhadoop.so -> libhadoop.so.1.0.0
-rwxr-xr-x. 1 root root  411870 6月   9 17:26 libhadoop.so.1.0.0
-rw-r--r--. 1 root root  581944 6月   9 17:26 libhadooputils.a
-rw-r--r--. 1 root root  273330 6月   9 17:26 libhdfs.a
lrwxrwxrwx. 1 root root      16 6月   9 17:26 libhdfs.so -> libhdfs.so.0.0.0
-rwxr-xr-x. 1 root root  181042 6月   9 17:26 libhdfs.so.0.0.0
[root@ganglia native]# file libhadoop.so
libhadoop.so: symbolic link to `libhadoop.so.1.0.0'
[root@ganglia native]# file libhadoop.so.1.0.0 
libhadoop.so.1.0.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
[root@ganglia native]# 


至此,我们的编译已经,成功完成,然后,我们就可以使用在target目录下,编译生成的hadoop新的tar.gz包,来部署我们的hadoop集群。






  • 大小: 301.5 KB
  • 大小: 295.3 KB
分享到:
评论

相关推荐

    Centos6.5编译64位Hadoop2.7.5.tat.gz

    【标题】"Centos6.5编译64位Hadoop2.7.5.tgz"涉及的关键技术点包括Hadoop、操作系统环境、源码编译以及系统兼容性。Hadoop是一个开源的分布式计算框架,它允许在大量廉价硬件上处理大规模数据。在这个场景中,用户将...

    基于centos6.5 已经编译好的hadoop-2.6.4

    标题"基于centos6.5 已经编译好的hadoop-2.6.4"指的是在CentOS 6.5操作系统环境下,已经完成了对Hadoop 2.6.4版本的编译工作。这通常意味着用户可以直接在同样环境或相似环境中使用这个编译好的版本,而无需自己进行...

    hadoop 64位下载 centos6.5环境编译

    在这个场景中,我们关注的是在64位操作系统环境下,在CentOS 6.5这个Linux发行版上安装和编译Hadoop的过程。 首先,我们需要理解Hadoop的核心组件。Hadoop主要由两个关键部分组成:Hadoop Distributed File System ...

    hadoop-2.8.1 CentOS6.5编译的源码

    《Hadoop 2.8.1在CentOS6.5上的源码编译详解》 Hadoop是一个开源的分布式计算框架,广泛应用于大数据处理领域。本文将深入探讨如何在CentOS 6.5操作系统上,从源代码编译Hadoop 2.8.1版本,以获取针对该系统的优化...

    hadoop2.x编译实例

    本章节主要介绍如何在 CentOS 6.5 系统上搭建 Hadoop 2.2.0 的开发环境,并进行编译。 ##### 1.1 安装 JDK 在编译 Hadoop 前,首先需要安装 JDK 并配置其环境变量。这里以 jdk-7u79-linux-x64 版本为例: 1. **...

    centos-6.7编译成功的hadoop-2.6.4,linux可用

    本压缩包文件"centos-6.7编译成功的hadoop-2.6.4"提供了一个在CentOS 6.7环境下编译好的Hadoop 2.6.4版本,使得用户可以直接使用,无需自行经历耗时的编译过程。 **Linux基础知识** Linux操作系统是基于Unix的操作...

    centos6.5编译好thrift

    标题中的“centos6.5编译好thrift”指的是在CentOS 6.5操作系统环境下,已经成功编译了Thrift 0.12.0版本。Thrift是一款开源跨语言的服务框架,由Facebook开发并贡献给Apache基金会,它的主要功能是帮助开发者构建...

    CentOS6.5编译Hadoop2.7.5(64位)详解,已编译好的64位包下载即可用

    背景Hadoop官网提供的编译包如hadoop-2.7.5.tar.gz为Linux32位环境编译,其中nativelibrary在64位环境中运行会出现异常。因而在64位生产环境中使用的Hadoop是需要下载源代码并在64位系统中进行成功编译后的版本。

    hadoop,centos6.5以上安装版

    hadoop centos6.5编译的安装版。包括hdfs,MapReduce。

    hadoop-2.7.4-with-centos-6.5.tar.gz

    在CentOS 6.5上编译Hadoop是出于兼容性和性能考虑。CentOS是一款基于Red Hat Enterprise Linux的开源操作系统,因其稳定性而被广泛用于服务器和大数据环境。64位版本的Linux系统能够支持更大的内存和更高效的计算,...

    cent os 6.5 编译hadoop2.6.0源码

    在本文中,我们将深入探讨如何在Cent OS 6.5操作系统上编译Hadoop 2.6.0的源码,以及如何利用编译生成的lib包目录替换官方下载资源中的对应目录。这个过程对于那些希望自定义Hadoop配置、优化性能或解决特定环境下的...

    centos6.5-hadoop-2.6.0-cdh5.9.0-nativelib

    标题“centos6.5-hadoop-2.6.0-cdh5.9.0-nativelib”提及的是一个专为64位CentOS 6.5操作系统编译的Hadoop 2.6.0 CDH 5.9.0的本地库(nativelib)打包文件。这个压缩包包含了运行Hadoop在CentOS环境下所需的本机库,...

    hadoop-eclipse-2.75插件 centos6.5 +eclipse编译

    本文将详细讲解如何在CentOS 6.5操作系统上配置Hadoop-eclipse插件,以便在Eclipse环境中进行Hadoop项目的开发和调试。 首先,我们需要在Eclipse中安装Hadoop-eclipse插件。这个插件使得开发者可以直接在Eclipse中...

    CentOS6.5下netcat工具安装教程

    ### CentOS6.5下netcat工具安装教程 #### 一、Netcat简介 Netcat(通常缩写为nc)是一个在网络编程中非常有用的工具。它能够读取或发送TCP/IP和UDP数据包,无需特殊权限即可创建监听端口。Netcat在安全审计、网络...

    编译过的Hadoop-2.6.0.tar.gz

    《Hadoop-2.6.0在CentOS6.5上的编译与集群搭建详解》 Hadoop,作为开源的大数据处理框架,是大数据领域的核心工具之一。版本2.6.0是其发展历程中的一个重要里程碑,它带来了诸多性能优化和功能增强。在本文中,我们...

    Hadoop2.4.1-x64& Hadoop2.6.0-x64

    文件为百度云下载链接,包含2.4.1 64位和32位,2.6.0 64位,...--编译环境:CentOS6.5 64 hadoop-2.4.1-x64.tar.gz ----2.4.1 64位 hadoop-2.4.1-x86.tar.gz ----2.4.1 32位 hadoop-2.6.0-x64.tar.gz ----2.6.0 64位

    hadoop-lzo-0.4.20.jar

    hadoop-lzo-0.4.20 centOS6.5 64位编译出来的 拷贝jar包到hadoop和hbase中 cp /opt/hadoopgpl/lib/hadoop-lzo-0.4.20-SNAPSHOT.jar $HADOOP_HOME/share/hadoop/common/ cp /opt/hadoopgpl/lib/hadoop-lzo-0.4.20-...

    编译hadoop-2.5.0-cdh5.3.6 + snappy 源码的native包

    本文将详细讲解如何在CentOS 6.5系统上编译Hadoop 2.5.0 - CDH5.3.6与Snappy的源码,以生成适用于该环境的native库。 首先,我们要了解Hadoop的native库是什么。Hadoop的native库是一组C++编译的库,它们提供了与...

    hadoop 2.7.1 64位编译 网盘地址

    hadoop 2.7.1是稳定版,官网上是32位编译的。在64位linux服务器运行有警告还有其他问题。此软件是在64位的 centos 6.5 下编译的。可放心使用

Global site tag (gtag.js) - Google Analytics