YARN 应用程序以退出代码退出:-1000 无法初始化用户目录

YARN Application exited with exitCode: -1000 Not able to initialize user directories

我得到:

Application application_1427711869990_0001 failed 2 times due to AM Container for appattempt_1427711869990_0001_000002 exited with exitCode: -1000 due to: Not able to initialize user directories in any of the configured local directories for user kailash
.Failing this attempt.. Failing the application.

我找不到与此退出代码和相关原因相关的任何信息。我正在使用 Hadoop 2.5.0 (Cloudera 5.3.2)。

实际上这是由于一些纱线本地目录的权限问题。我开始使用 LinuxContainerExecutor(在非安全模式下使用 nonsecure-mode.local-user 作为 kailash)并进行了相应的更改。但是由于某些(未知)原因,NodeManager 无法为用户清理本地目录,并且仍然存在以前用户的目录(在我的例子中是 yarn)。

所以要解决这个问题,我首先必须找到 属性 yarn.nodemanager.local-dirs 的值(Cloudera 使用搜索选项为 YARN 服务找到这个 属性,否则查看hadoop conf 目录中的 yarn-site.xml),然后删除所有节点管理器节点的 usercache 下的 files/directories。就我而言,我使用了:

rm -rf /yarn/nm/usercache/*

以防万一有人丢失了用户缓存位置。如果您没有在任何地方配置 yarn.nodemanager.local-dirs,请在默认位置 ${hadoop.tmp.dir}/nm-local-dir 中查找它。 同样,如果 hadoop.tmp.dir 没有配置在 core-site.xml 中,它将在 /tmp/hadoop-${user.name} 下。 user.name 是您用于 运行 当前 Hadoop 进程的 UNIX 用户。 所有的配置文件默认都在$HADOOP_INSTALL/etc/hadoop/下。

您需要应用此命令

rm -rf /dn/yarn/nm/usercache/* { 这是我的配置 }

请检查 YARN(包括 MR2)NodeManager 本地目录中的配置。

http://i.imgur.com/BHwhUnB.jpg

您需要将此应用于 YARN 报告错误的数据节点

这是我的例子

http://i.imgur.com/miNx454.jpg

ApplicationMaster 报告 C90BFH04.localdomain:8042 ,这是数据节点 4 。所以我只申请了4号节点的YARN目录

之后一切正常!

当我用集群模式测试 spark-submit-on-yarn 和 actor 时:

spark-submit --master yarn --deploy-mode cluster --class org.apache.spark.examples.SparkPi /usr/local/install/spark-2.2.0-bin-hadoop2.7/examples/jars/spark-examples_2.11-2.2.0.jar 100 和我一样的错误:

Application application_1532249549503_0007 failed 2 times due to AM Container for appattempt_1532249549503_0007_000002 exited with exitCode: -1000 Failing this attempt.Diagnostics: java.io.IOException: Resource file:/usr/local/install/spark-2.2.0-bin-hadoop2.7/examples/jars/spark-examples_2.11-2.2.0.jar changed on src filesystem (expected 1531576498000, was 1531576511000

最后,我修复了在 $HADOOP_HOME/etc/hadoop/core-site.xml

中设置 属性 fs.defaultFS 的错误