首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >火花纱.集群模式hdfs io文件路径配置

火花纱.集群模式hdfs io文件路径配置
EN

Stack Overflow用户
提问于 2016-07-04 06:51:25
回答 1查看 350关注 0票数 0

我尝试使用psuedo模式在名称节点服务器上运行下面的基本火花字计数示例:Hadoop2.6.0

代码语言:javascript
复制
import org.apache.spark.{SparkConf, SparkContext}

object WordCount {
  def main(args: Array[String]){

    //args(0): input file name, args(1): output dir name
    //e.g. hello.txt hello
    val conf = new SparkConf().setAppName("WordCount")
    val sc = new SparkContext(conf)

    val input = sc.textFile(args(0))
    val words = input.flatMap(_.split(" "))
    val counts = words.map((_, 1)).reduceByKey(_ + _)

    counts.saveAsTextFile(args(1))
  }
}

像这样的start.sh文件..。

代码语言:javascript
复制
$SPARK_HOME/bin/spark-submit \
--master yarn-cluster \
--class com.gmail.hancury.hdfsio.WordCount \
./target/scala-2.10/sparktest_2.10-1.0.jar hello.txt server_hello

当我写入输入文件路径时,如

hdfs://master:port/path/to/input/hello.txt

hdfs:/master:port/path/to/input/hello.txt

/path/to/input/hello.txt

一些神秘的附加路径会自动附加。

/user/${user.name}/input/

所以,如果我编写了像/user/curycu/input/hello.txt这样的路径,那么应用路径就像这样:/user/curycu/input/user/curycu/input/hello.txt

因此出现了一个fileNotFound异常。

,我想知道这条神奇的路到底是从哪里来的.

我已经检查过core-site.xml、丝-site.xml、hdfs-site.xml、mapred-site.xml、spark_env.sh、名称-节点服务器的火花-defaults.conf,但是对于/user/${user.name}/input没有任何线索。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-07-27 06:12:11

当您不使用程序集jar (uber Jar)时,会发生上述所有错误。

不是sbt package

使用sbt assembly

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38178457

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档