您的位置:首页 > 其它

Spark生态之Alluxio学习2---Spark从tachyon中读取文件

2016-05-04 22:46 465 查看
1.启动spark-shell

2.上传文件到tachyon:

xubo@xubo:~/cloud/test/tachyon$ ../../tachyon-0.7.1/bin/tachyon tfs copyFromLocal 1.txt /
Copied 1.txt to /
xubo@xubo:~/cloud/test/tachyon$ ../../tachyon-0.7.1/bin/tachyon tfs cat /1.txt
hello tachyon
1
2
3


3.读取:

scala> val text1= sc.textFile("tachyon://localhost:19998/1.txt")
text1: org.apache.spark.rdd.RDD[String] = MapPartitionsRDD[1] at textFile at <console>:21

scala> text
text1   text

scala> text1.foreach
foreach            foreachPartition   foreachWith

scala> text1.foreach
def foreach(f: T => Unit): Unit

scala> text1.foreach(println)
1
hello tachyon
2
3
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息