学习 Alluxio(二):支持 Spark

栏目: 数据库 · 发布时间: 7年前

内容简介:以使用 Maven 的 Java 工程为例,如果,有以下三种方式:第一种方式:将第二种方式:添加

环境:

  • Spark 2.2.2
  • Alluxio 1.8

开发环境

以使用 Maven 的 Java 工程为例,如果,有以下三种方式:

第一种方式:将 <ALLUXIO_HOME>/client/alluxio-1.8.0-client.jar JAR 文件上传到 Nexus 服务器

第二种方式:添加 <ALLUXIO_HOME>/client/alluxio-1.8.0-client.jar JAR 文件作为系统依赖:

<dependency>  
    <groupId>org.alluxio</groupId>
    <artifactId>client</artifactId>
    <version>1.8.0</version>
    <scope>system</scope>
    <systemPath>${ALLUXIO_HOME}/client/alluxio-1.8.0-client.jar</systemPath>
</dependency>

第三种方式:安装 <ALLUXIO_HOME>/client/alluxio-1.8.0-client.jar 到本地仓库。

执行命令:

mvn install:install-file -Dfile=$ALLUXIO_HOME/client/alluxio-1.8.0-client.jar -DgroupId=org.alluxio -DartifactId=client -Dversion=1.8.0 -Dpackaging=jar -DgeneratePom=true

添加依赖:

<dependency>  
    <groupId>org.alluxio</groupId>
    <artifactId>client</artifactId>
    <version>1.8.0</version>
    <scope>provided</scope>
</dependency>

部署环境

为了 Spark 可以读写 Alluxio,Alluxio 客户端 JAR 文件需要分发到 Spark 集群下各个节点,可以在 Spark 客户端进行配置:

编辑 <SPARK_HOME>/confspark-defaults.conf 文件:

spark.driver.extraClassPath /${ALLUXIO_HOME}/client/alluxio-1.8.0-client.jar  
spark.executor.extraClassPath /<ALLUXIO_HOME>/client/alluxio-1.8.0-client.jar

使用

读数据:

spark.read  
  .json("alluxio://alluxio_master:19998/data/users")

写数据:

spark.write.json("alluxio://alluxio_master:19998/data/users")

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

A Common-Sense Guide to Data Structures and Algorithms

A Common-Sense Guide to Data Structures and Algorithms

Jay Wengrow / Pragmatic Bookshelf / 2017-8-13 / USD 45.95

If you last saw algorithms in a university course or at a job interview, you’re missing out on what they can do for your code. Learn different sorting and searching techniques, and when to use each. F......一起来看看 《A Common-Sense Guide to Data Structures and Algorithms》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

SHA 加密
SHA 加密

SHA 加密工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具