maven 3.3.9编译spark1.5.0 cdh5.5.1

来源:互联网 发布:网络服务器机柜 品牌 编辑:程序博客网 时间:2024/04/28 15:39
1、下载spark源码解压到目录/usr/local/spark-1.5.0-cdh5.5.1,看看是否有pom.xml文件
2、切换到目录/usr/local/spark-1.5.0-cdh5.5.1执行:
编译spark源代码的时候,需要从网上下载依赖包,所以整个编译过程机器必须保证在联网状态。编译执行如下脚本:
[hadoop@hadoop spark-1.5.0-cdh5.5.1]$ export MAVEN_OPTS="-Xmx2g -XX:MaxPermSize=512M -X:ReservedCodeCacheSize=512m"
[hadoop@hadoop spark-1.5.0-cdh5.5.1]$mvn -Pyarn -Dhadoop.version=2.5.0-cdh5.3.3  -Dscala-3.9.9 -Phive -Phive-thriftserver   -DskipTests clean package
编译报错解决方法:
vi /usr/local/maven/conf/settings.xml
添加红色部分
<servers>
    <server>
      <id>hadoop</id>
      <username>hadoop</username>
      <password>hadoop</password>
      <privateKey>/home/hadoop/.ssh/id_rsa</privateKey>
      <passphrase>some_passphrase</passphrase>
      <filePermissions>664</filePermissions>
      <directoryPermissions>775</directoryPermissions>
      <configuration></configuration>
    </server>
  </servers>
vi /usr/local/spark/pom.xml
添加下面红色部分:
<modules>
    <module>core</module>
    <module>bagel</module>
    <module>graphx</module>
    <module>mllib</module>
    <module>tools</module>
    <module>network/common</module>
    <module>network/shuffle</module>
    <module>streaming</module>
    <module>sql/catalyst</module>
    <module>sql/core</module>
    <module>sql/hive</module>
    <module>unsafe</module>
    <module>assembly</module>
    <module>external/twitter</module>
    <module>external/flume</module>
    <module>external/flume-sink</module>
    <!-- Disabled in CDH.
    <module>external/flume-assembly</module>
    -->
    <module>sql/hive-thriftserver</module>
    <module>external/mqtt</module>
    <module>external/mqtt-assembly</module>
    <module>external/zeromq</module>
    <module>examples</module>
    <module>repl</module>
    <module>launcher</module>
    <module>external/kafka</module>
    <!-- Disabled in CDH
    <module>external/kafka-assembly</module>
    -->
  </modules>
3、生成Spark部署包:
./make-distribution.sh --name 2.5.0 --tgz --with-tachyon

Spark源码根目录下有一个生成部署包的脚本make-distribution.sh,可以通过执行如下命令进行打包 ./make-distribution.sh [--name] [--tgz] [--with-tachyon] <maven build options>

l  --name NAME--tgz 结合可以生成spark-$VERSION-bin-$NAME.tgz 的部署包,不加此参数时NAME hadoop 的版本号

l  --tgz在根目录下生成 spark-$VERSION-bin.tgz ,不加此参数时不生成tgz 文件,只生成/dist 目录

l  --with-tachyon  是否支持内存文件系统Tachyon ,不加此参数时不支持tachyon



0 0