spark源碼編譯發佈

源碼

將項目源碼clone源碼到本地

項目地址:https://github.com/apache/spark

git clone git@github.com:apache/spark.git
編譯

spark項目同時支持maven和sbt兩種方式,以maven爲例:

最簡單的編譯:

./build/mvn -DskipTests clean package

使用 -D 和 -P參數定製不同的編譯版本:

# Apache Hadoop 2.6.X
./build/mvn -Pyarn -DskipTests clean package

# Apache Hadoop 2.7.X and later
./build/mvn -Pyarn -Phadoop-2.7 -Dhadoop.version=2.7.3 -DskipTests clean package

# With Hive 1.2.1 support
./build/mvn -Pyarn -Phive -Phive-thriftserver -DskipTests clean package

編譯子項目:

上述命令爲全量編譯,我們可以選擇只編譯某個子模塊:

./build/mvn -pl :spark-streaming_2.11 clean install
發佈
./dev/make-distribution.sh --name custom-spark --pip --r --tgz -Psparkr -Phadoop-2.7 -Phive -Phive-thriftserver -Pmesos -Pyarn -Pkubernetes

執行上述命令,會在dist目錄生成發佈軟件包,與在spark官網下載的軟件包是一樣的。

需要注意:

  1. 安裝 R 和 pip 環境

    https://blog.csdn.net/duxu24/article/details/53611510

  2. R安裝插件: install.packages(‘knitr’) install.packages(“rJava”)

    https://github.com/hannarud/r-best-practices/wiki/Installing-RJava-(Ubuntu)

  3. 如果覺得1 2 麻煩,可以不編譯 pip和r package,即不支持python和r
    ./dev/make-distribution.sh --name custom-spark --tgz -Psparkr -Phadoop-2.7 -Phive -Phive-thriftserver -Pmesos -Pyarn -Pkubernetes

參考:

https://spark.apache.org/docs/latest/building-spark.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章