Execute the following command under Hadoop 2.7.2 cluster:
Spark-shell--master Yarn--deploy-mode Client
The following error has been burst:
Org.apache.spark.SparkException:Yarn application has already ended! It might has been killed or unable to launch application master.
On the Yarn WebUI view the cluster status of the boot, log is displayed as:
Container [pid=28920,containerid=container_1389136889967_0001_01_000121] is running beyond virtual memory limits. Current
usage:1.2 GB of 1 GB physical memory used; 2.2 GB of 2.1 GB virtual memory used. Killing container.
This is because the virtual memory size exceeds the set value, you can modify the configuration, to circumvent.
There is a check placed at Yarn level for vertual and physical memory usage ratio. Issue is not the only that VM doesn ' t has sufficient pysical memory. But it's because Virtual memory usage is more than expected for given physical memory.
Note : This was happening on Centos/rhel 6 due to its aggressive allocation of virtual memory.
It can resolved either by:
- Disable Virtual memory usage check by setting yarn.nodemanager.vmem-check-enabled to false;
- Increase vm:pm ratio by setting yarn.nodemanager.vmem-pmem-ratio to some higher value (default value is 2.1).
Add following property in Yarn-site.xml
&NBSP;<PROPERTY>
<NAME>YARN.NODEMANAGER.VMEM-CHECK-ENABLED</NAME>
<VALUE>FALSE</VALUE>
&N Bsp <description>whether virtual memory limits is enforced for Containers</description>
& nbsp </property>
<property>
&NB Sp <name>yarn.nodemanager.vmem-pmem-ratio</name>,
& nbsp <value>4</value>
<description>ratio between Virtual memory to physical memory when setting memory limits for Containers</description>
</prop Erty>
3.Then, restart yarn.
Reference:
http://blog.cloudera.com/blog/2014/04/apache-hadoop-yarn-avoiding-6-time-consuming-gotchas/
Http://blog.chinaunix.net/uid-28311809-id-4383551.html
Http://stackoverflow.com/questions/21005643/container-is-running-beyond-memory-limits
Execute "spark-shell–master yarn–deploy-mode client", Virtual memory size overflow, error