-
Notifications
You must be signed in to change notification settings - Fork 4
编译指定版本的Spark
刘军强 edited this page Jul 21, 2018
·
2 revisions
编译Spark的方式有三种:
- SBT编译
- maven编译
- make-distribution.sh脚本编译
实际上make-distribution.sh脚本只是将maven的一些指令封装成了脚本,下面使用make-distribution.sh脚本进行编译:
为了编译更加快速,可以修改make-distribution.sh脚本的几个参数:
VERSION=2.2.0
SCALA_VERSION=2.11.8
SPARK_HADOOP_VERSION=2.6.0-cdh5.7.0
SPARK_HIVE=1
#VERSION=$("$MVN" help:evaluate -Dexpression=project.version $@ 2>/dev/null | grep -v "INFO" | tail -n 1)
#SCALA_VERSION=$("$MVN" help:evaluate -Dexpression=scala.binary.version $@ 2>/dev/null\
# | grep -v "INFO"\
# | tail -n 1)
#SPARK_HADOOP_VERSION=$("$MVN" help:evaluate -Dexpression=hadoop.version $@ 2>/dev/null\
# | grep -v "INFO"\
# | tail -n 1)
#SPARK_HIVE=$("$MVN" help:evaluate -Dexpression=project.activeProfiles -pl sql/hive $@ 2>/dev/null\
# | grep -v "INFO"\
# | fgrep --count "<id>hive</id>";\
# Reset exit status to 0, otherwise the script stops here if the last grep finds nothing\
# because we use "set -o pipefail"
# echo -n)
上面是将hadoop,spark,hive对应的版本号直接填写进行,因为它是通过参数自动生成版本号,因此解析很耗时,所以我们直接指定注释掉自动获取版本号的代码来提高编译速度。
编译源码首先要下载相应的源码,然后使用脚本脚本进行编译:
./dev/make-distribution.sh --tgz \
-Phadoop-2.6 -Dhadoop-version=2.6.0-cdh5.7.0 \
-Pyarn \
-Phive-2.3.0 -Phive-thriftserver