我的火花环境
Spark -> 2.1.0
Hadoop -> 2.8.1
Eclipse -> Neon 2
我在纱线模式下获得火花上下文时卡住了。我如何在纱线模式下获得火花上下文,请帮助我解决。
我的Hadoop,纱线和Spark安装成功。
$ jps
3200 NameNode
5264 ExecutorLauncher
5328 CoarseGrainedExecutorBackend
3555 SecondaryNameNode
5316 CoarseGrainedExecutorBackend
7590 Jps
3357 DataNode
4045 NodeManager
5118 SparkSubmit
3727 ResourceManager
我以纱线模式获得火花上下文的源代码: -
public class JavaClient {
public static void main(String[] args) {
// TODO Auto-generated method stub
SparkConf conf = new SparkConf().setAppName("SparkTest").setMaster("yarn-client");
SparkSession spark = SparkSession.builder().config(conf).getOrCreate();
System.out.println(spark.version() + " : " + spark.sparkContext());
}
}
输出: -
17/09/22 10:24:11 INFO Client: Application report for application_1506052073594_0011 (state: ACCEPTED)
17/09/22 10:24:12 INFO Client: Application report for application_1506052073594_0011 (state: ACCEPTED)
17/09/22 10:24:13 INFO Client: Application report for application_1506052073594_0011 (state: ACCEPTED)
.
.
.
等等,不返回火花会话。
在资源管理器UI(Localhost:8088)中检查您的Application Master和执行者的可用内存/CPU插槽
尝试" YARN",而不是"纱线 - client"
公共类JavaClient {
public static void main(String[] args) {
// TODO Auto-generated method stub
SparkConf conf = new SparkConf().setAppName("SparkTest").setMaster("yarn");
SparkSession spark = SparkSession.builder().config(conf).getOrCreate();
System.out.println(spark.version() + " : " + spark.sparkContext());
}