Spark java.io.IOException: Can't get Master Kerberos principal for use as renewer 错误解决

一、概述

 当集群开启了Kerberos后,Spark向hive中写入数据时,代码中会去读取yarn的配置文件,如果读不到yarn的配置文件,就会报这样的错误。如果用IDEA开发的ETL程序直接在CDH上面运行是没有这个问题的;但是当程序在第三方机器上运行时就会包这个错误。因为Spark客户端需要将yarn-site.xml加载。如果只是拷贝了hdfs-site.xml、core-site.xml、hive-site.xml没有拷贝yarn-site.xml就会报这个错误。

二、解决方法

 去CDH平台中下载客户端配置文件信息,然后将hdfs-site.xml、core-site.xml、hive-site.xml、yarn-site.xml拷贝到Spark客户端的conf目录下面。然后再使用spark-submit提交就没有问题了。

原文地址:https://www.cnblogs.com/chhyan-dream/p/13491828.html