spark集群想要使用alluxio集群作为文件存储系统。
alluxio集群搭建:https://my.oschina.net/u/2874009/blog/737773
spark集群搭建:https://my.oschina.net/u/2874009/blog/733919
下载alluxio-core-client-spark-1.2.0-jar-with-dependencies.jar,放在alluxio的安装目录下。
按照上面链接搭建完spark和alluxio集群,想要把两者结合在一起,需要再spark的配置文件中增加配置。
进入spark安装目录下的conf目录,编辑spark-env.sh文件
export SPARK_CLASSPATH=/data/program/alluxio/alluxio-1.2.0/alluxio-core-client-spark-1.2.0-jar-with-dependencies.jar:$SPARK_CLASSPATH
重启spark就可以了
scala文件中,可以读取alluxio中的文件
var appenDataPath = "alluxio://x01:19998/data/spark/appendata/test.txt"