无法解析主URL:'spark:http:// localhost:18080' [英] Could not parse Master URL: 'spark:http://localhost:18080'

查看:1779
本文介绍了无法解析主URL:'spark:http:// localhost:18080'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试运行我的代码时,它会抛出异常

When I'm trying to run my code it throws this Exception:

Exception in thread "main" org.apache.spark.SparkException: Could not parse Master URL:spark:http://localhost:18080

这是我的代码:

SparkConf conf = new SparkConf().setAppName("App_Name").setMaster("spark:http://localhost:18080").set("spark.ui.port","18080");
JavaStreamingContext ssc = new JavaStreamingContext(sc, new Duration(1000));
String[] filet=new String[]{"Obama","ISI"};

JavaReceiverInputDStream<Status> reciverStream=TwitterUtils.createStream(ssc,filet);
JavaDStream<String> statuses = reciverStream.map(new Function<Status, String>() {
     public String call(Status status) { return status.getText(); }
     }
      );
ssc.start();
ssc.awaitTermination();}}

任何想法如何解决这个问题?

Any idea how can I fix this problem?

推荐答案

问题是您在传递给 SparkConf.setMaster()的URL中指定了2个模式

spark 是架构,因此您无需添加 http spark 之后。请参阅 <$ c的javadoc $ c> SparkConf.setMaster() 更多示例。

The spark is the schema, so you don't need to add http after spark. See the javadoc of SparkConf.setMaster() for more examples.

因此您应该使用的主URL是 火花://本地主机:18080。更改此行:

So the master URL you should be using is "spark://localhost:18080". Change this line:

SparkConf conf = new SparkConf().setAppName("App_Name")
    .setMaster("spark://localhost:18080").set("spark.ui.port","18080");

这篇关于无法解析主URL:'spark:http:// localhost:18080'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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