从远程位置的Apache星火阅读csv文件(FTP) [英] Read csv file in Apache Spark from remote location (ftp)

查看:226
本文介绍了从远程位置的Apache星火阅读csv文件(FTP)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Ubuntu的机器上的文件,我想在Apache的火花阅读。

I have a file in a Ubuntu machine which I want to read in Apache spark .

我发现这个例子:

object BasicTextFromFTP {
    def main(args: Array[String]) {
      val conf = new SparkConf
      conf.setMaster(args(0))
      val sc = new SparkContext(conf)
      val file = sc.textFile("ftp://anonymous:pandamagic@ftp.ubuntu.com/ubuntu/ls-LR.gz")
      println(file.collect().mkString("\n"))
    }
}

此链接:

<一个href=\"https://github.com/databricks/learning-spark/blob/master/src/main/scala/com/oreilly/learningsparkexamples/scala/BasicLoadTextFromFTP.scala\" rel=\"nofollow\">https://github.com/databricks/learning-spark/blob/master/src/main/scala/com/oreilly/learningsparkexamples/scala/BasicLoadTextFromFTP.scala

我不知道如何创建URL。请帮我这一点。

I don’t understand how the URL is created. Please help me with this.

推荐答案

该URL的基本结构是其次

Basic structure of the URL is a schema type (here ftp) followed by

//<user>:<password>@<host>:<port>/<url-path>

在这里可以忽略不计的每个部分的主机。

where every part excluding host can be omitted.

这篇关于从远程位置的Apache星火阅读csv文件(FTP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆