Yarn初始化异常:Not able to initialize user directories.exitCode:-1000

最近碰到这么一个异常:

Application application_1528180019666_0366 failed 2 times due to AM Container
for appattempt_1528180019666_0366  exited with exitCode: -1000
For more detailed output, check application tracking page:http://
datanode3:8088/proxy/application_1528180019666_0366 /Then, click on links to
logs of each attempt.Diagnostics: Not able to initialize user directories in
any of the configured local directories for user hadoop
Failing this attempt. Failing the application.

刚开始的时候看到这个问题的时候没有头绪,提交的spark程序从hadoop的日志来看,还没开始进行运算,也就是说在yarn初始化的时候出问题了。那么直接贴解决方案:
从错误信息上我们不难看出

Not able to initialize user directories in any of the configured local directories for user hadoop

这是是关于用户本地缓存资源无法初始化的问题,其实就是一个权限的问题。
最简便而受用的的方式是我们打开集群的yarn-site.xml 找到下面的属性:

<property>
	<name>yarn.nodemanager.local-dirs</name>
	<value>/hadoop/disk1/yarn/local/,/hadoop/disk2/yarn/local</value>
</property>

该属性可设置多个目录,是用来存放执行Container所需的数据(比如可执行程序或JAR包、配置文件等)和运行过程中产生的临时数据的。

其中该目录集合中都有一个usercache文件夹,我们要做的只需要将usercache文件夹下的内容清空,需要所有的集群节点都执行一次或多次清除,以我上面配置的目录为例:

rm -rf /haoop/disk1/yarn/local/usercache/*
rm -rf /haoop/disk2/yarn/local/usercache/*

所有节点清除完成后重启所有集群节点,重启yarn。
再次运行你会发现你的应用程序初始化成功开始运行了。

posted @ 2019-01-30 14:59  sssuperMario  阅读(376)  评论(0)    收藏  举报