hadoop-2.6.0-cdh5.7.0源碼編譯支持壓縮

準備:
解壓hadoop-2.6.0-cdh5.7.0.tar.gz源碼包,看到裏面有個BUILDING.txt文件,裏面列出了編譯所需依賴組件。app

Requirements:oop

  • Unix System
  • JDK 1.7+
  • Maven 3.0 or later
  • Findbugs 1.3.9 (if running findbugs)
  • ProtocolBuffer 2.5.0
  • CMake 2.6 or newer (if compiling native code), must be 3.0 or newer on Mac
  • Zlib devel (if compiling native code)
  • openssl devel ( if compiling native hadoop-pipes )
  • Internet connection for first build (to fetch all Maven and Hadoop dependencies)

轉載連接文章中或經過yum安裝或經過本身下載提供了全部正確版本組件,並將已下載組件經過百度雲分享。
我想補充一點的是,yum安裝可能報出Another app is currently holding the yum lock; waiting for it to exit...的錯誤,可參考https://blog.csdn.net/testcs_...
強制關閉yum進程來解決。fetch


編譯:ui

根據BUILDING.txt提示.net

Build options:code

  • Use -Pnative to compile/bundle native code * Use -Pdocs to

generate & bundle the documentation in the distribution (using -Pdist)blog

  • Use -Psrc to create a project source TAR.GZ * Use -Dtar to create a TAR with the distribution (using -Pdist)

Building distributions:進程

Create binary distribution without native code and without
documentation:ip

$ mvn package -Pdist -DskipTests -Dtarhadoop

Create binary distribution with native code and with documentation:

$ mvn package -Pdist,native,docs -DskipTests -Dtar

cd到解壓後的hadoop-2.6.0-cdh5.7.0源碼目錄下,使用mvn -e clean package -Pdist,native -DskipTests -Dtar編譯(使用-e參數輸出錯誤堆棧信息,有利於定位),編譯完成後,默認會在源碼根目錄的hadoop-dist目錄下生成target,裏面的hadoop-2.6.0-cdh5.7.0文件夾就是已經編譯好並已解壓的hadoop了(直接用的),能夠將其拷貝到自定義的位置進行部署配置。

[root@NN1 hadoop-2.6.0-cdh5.7.0]# ./bin/hadoop checknative
19/04/10 11:22:34 INFO bzip2.Bzip2Factory: Successfully loaded & initialized native-bzip2 library system-native
19/04/10 11:22:34 INFO zlib.ZlibFactory: Successfully loaded & initialized native-zlib library
Native library checking:
hadoop:  true /root/hadoop-c/hadoop-2.6.0-cdh5.7.0-target/hadoop-2.6.0-cdh5.7.0/lib/native/libhadoop.so.1.0.0
zlib:    true /lib64/libz.so.1
snappy:  true /lib64/libsnappy.so.1
lz4:     true revision:99
bzip2:   true /lib64/libbz2.so.1
openssl: true /lib64/libcrypto.so

能夠看到編譯的hadoop支持了各類壓縮,親測有效!

相關文章
相關標籤/搜索