正在学习《Spark快速大数据分析》第七章-在集群上运行Spark,写了一个单词数量统计的Spark程序提及到Yarn,但是状态一直是Accepted,等待运行。
1、排查了Yarn资源调度器配置,配置的是公平配置,确认无问题
<property>
<name>yarn.scheduler.fair.allocation.file</name>
<value>/opt/hadoop/hadoop-3.2.4/etc/hadoop/fair-scheduler.xml</value>
</property>
<property>
<name>yarn.resourcemanager.scheduler.class</name>
<value>org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler</value>
</property>
<property>
<name>yarn.nodemanager.resource.memory-mb</name>
<value>20480</value>
</property>
<property>
<name>yarn.scheduler.minimum-allocation-mb</name>
<value>100</value>
</property>
<property>
<name>yarn.nodemanager.vmem-pmem-ratio</name>
<value>2.1</value>
</property>
<property>
<name>yarn.nodemanager.resource.cpu-vcores</name>
<value>20</value>
</property>
<?xml version="1.0"?>
<allocations>
<queue name="default">
<minResources>100mb,1vcores</minResources>
<maxResources>20480mb,20vcores</maxResources>
<weight>1</weight>
<schedulingPolicy>fifo</schedulingPolicy>
</queue>
<queuePlacementPolicy>
<rule name="specified" create="false"></rule>
<rule name="primaryGroup" create="false"></rule>
<rule name="user" create="false"></rule>
<rule name="default" queue="default"></rule>
</queuePlacementPolicy>
</allocations>
2、在网上搜了一下类似的问题,发现有人是因为yarn resourcemanager或者nodemanager 未启动导致的,通过 jps 命令可以确认相关进程已存在。然后检查yarn管理页面的集群节点状态时发现“Active Node”数量是0,“Unhealthy Node”的数量是1,点进去查看详情:
日志显示:
1/1 local-dirs usable space is below configured utilization percentage/no more usable space [ /opt/hadoop/hadoop-3.2.4/tmp/nm-local-dir : used space above threshold of 90.0% ] ;
1/1 log-dirs usable space is below configured utilization percentage/no more usable space [ /opt/hadoop/hadoop-3.2.4/logs/userlogs : used space above threshold of 90.0%
问题的原因就找到了:磁盘空间不足
在虚拟机中删除一些文件,剩余空间大于3g之后,重新启动 hdfs 和 yarn ,再重新提交任务就成功完成了。
spark-submit --class com.chenxii.myspark.sparkcore.ch7.WordCountV2 --master yarn --queue default spark-core-1.1.0.jar
标签:usable,space,hadoop,yarn,Yarn,scheduler,Spark,Accepted
From: https://www.cnblogs.com/chenxii81/p/17625267.html