由于我的hdfs集群配置了HA,在提交spark任务时,提示:java.net.UnknownHostException: cluster1。于是寻找解决方案。
首先参考:
1.复制hdfs-site.xml到spark的配置目录,没效果
2.复制hdfs-site.xml和core-site.xml到spark的配置目录,没效果
所以上面这篇文章没效果,通过google,找到这篇文章:
在这篇文章中找到了这么一句话:I've found the solution - adding "spark.files file:///opt/spark/conf/hdfs-site.xml,file:///opt/spark/conf/core-site.xml" to conf/spark-defaults.conf on each slave
3.于是我也在我的spark-default.xml加上了下面这一句配置
spark.files file:///home/bigdata/apps/spark-1.5.0-bin-hadoop2.6/conf/hdfs-site.xml,file:///home/bigdata/apps/spark-1.5.0-bin-hadoop2.6/conf/core-site.xml
重新启动spark集群,不再提示上面那个错误。
所以解决此问题的关键是在spark-default.xml中加上spark.files这个配置。