zoukankan      html  css  js  c++  java
  • Hadoop 源码编译

    1. 源码编译原因

    • Apache Hadoop 官方提供的是32位源码,而Windows为64位;

    2. 编译准备工作

    • Ubuntu(64位)
    • jar 包准备(hadoop 源码, JDK8, maven, ant, protobuf)
      • hadoop-2.8.5-src.tar.gz
      • jdk-8u144-linux-x64.tar.gz
      • apache-ant-1.9.14-bin.tar.gz(build 工具,打包用的)
      • apache-maven-3.6.0-bin.tar.gz
      • protobuf-2.5.0.tar.gz(序列化的框架)

    2.1 安装protobuf

    ### 1. 安装 glibc-headers 和 g++ 命令
    yum install glibc-headers
    yum install gcc-c++
    
    ### 2. 安装 make 和 cmake
    yum install make
    yum install cmake
    
    ### 3. 解压 protobuf
    tar -zxvf protobuf-2.5.0.tar.gz -C /opt/module
    
    ### 4. 进入 protobuf 主目录: /opt/module/protobuf-2.5.0
    cd /opt/module/protobuf-2.6.0
    
    ### 5. 执行以下命令
    ./configure
    make
    make check
    make install
    ldconfig
    
    ### 6. 配置环境变量
    vim /etc/profile
    #LD_LIBRARY_PATH
    export LD_LIBRARY_PATH=/opt/module/protobuf-2.5.0
    export PATH=$PATH:$LD_LIBRARY_PATH
    
    ### 7. 验证命令
    protoc --version
    
    ### 8. 安装 openssl 库
    yum install openssl-devel
    
    ### 9. 安装 ncurses-devel 库
    yum install ncurses-devel
    

    3. 编译源码

    ### 1. 解压源码到 /opt/ 目录
    tar -zxvf hadoop-2.8.5-src.tar.gz -C /opt/
    
    ### 2. 进入到 hadoop 源码主目录
    cd /opt/hadoop-2.8.5-src
    
    ### 3. 通过 maven 执行编译命令 (大约半小时)
    mvn package -Pdist,native -DskipTests -Dtar
    
    ### 4. 编译成功后,hadoop 包在 /opt/hadoop-2.8.5-src/hadoop-dist/target 下
    

    4. 编译过程中的问题

    • “A required class is missing: org/apache/maven/plugin/surefire/SurefireReportParameters”
    ### 解决方案,pom.xml 中添加以下内容
    <project>
      ...
      <build>
        <!-- To define the plugin version in your parent POM -->
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
              <version>2.17</version>
            </plugin>
            ...
          </plugins>
        </pluginManagement>
        <!-- To use the plugin goals in your POM or parent POM -->
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.17</version>
          </plugin>
          ...
        </plugins>
      </build>
      ...
    </project>
    

    参考资料:

  • 相关阅读:
    CF #536div2E(dp)
    BZOJ2440(容斥+莫比乌斯函数)
    莫比乌斯反演题目结(下)
    struts 文件上传示例
    struts 文件上传示例
    struts2请求过程源码分析
    struts2请求过程源码分析
    如何快速成为数据分析师?
    如何快速成为数据分析师?
    多对多 hibernate映射
  • 原文地址:https://www.cnblogs.com/linkworld/p/10926946.html
Copyright © 2011-2022 走看看