我得到:
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),然后删除所有节点管理器节点的用户缓存下的文件/目录。就我而言,我使用了:
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
You need to apply this to data nodes that reported error by YARN
这是我的案例
http://i.imgur.com/miNx454.jpg
ApplicationMaster 报告 C90BFH04.localdomain:8042 ,这是数据节点 4 。所以我只申请了 4 号节点中的 YARN 目录
之后一切就OK了!
当我用集群模式测试 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
来修复错误
hdfs fsck -list-corruptfileblocks
hdfs fsck -delete