2016-07-18 80 views
0

我有一个火花卡桑德拉连接器应用,代码的配置部分有:为Spark YARN集群模式设置类路径的好方法?

val conf = new SparkConf(true).setAppName("Some Name") 
    .set("spark.cassandra.connection.host", "127.0.0.1") 
    .set("spark.executor.extraClassPath", "/absolute_path_to/my.jar") 
val sc = new SparkContext("spark://127.0.0.1:7077", "App", conf) 

和我一起提交:

spark-submit --class com.data.MyApp --master yarn --deploy-mode cluster \ 
--executor-cores 2 --num-executors 2 --executor-memory 4G \ 
--jars /absolute_path_to/my.jar ./target/scala-2.10/ds-spark-assembly-1.0.jar 

我可以做它的工作。但是我可以在我的代码中使用“相对路径”spark.executor.extraClassPath吗?如果可以,路径是相对于所有群集节点中的哪个位置?

感谢

回答

0

我使其工作为:

val conf = new SparkConf(true).setAppName("Some Name") 
    .set("spark.cassandra.connection.host", "127.0.0.1") 
    .setJars(Seq("my.jar")) 
val sc = new SparkContext("spark://127.0.0.1:7077", "App", conf) 

而且我也不需要把--jar选项​​。

相关问题