我正在尝试运行spark作业来使用Spark SQL处理一些Json数据。当我提交作业时,我在日志中看到以下错误,
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00007f29b96d5000, 12288, 0) failed; error='Cannot allocate memory' (errno=12)
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 12288 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /tmp/hs_err_pid5716.log
我在应用程序中使用以下代码,
val url = "foo://fooLink"
val rawData = sqlContext.read.option("multiline", true).json(url)
val pwp = new PrintWriter(new File("/tmp/file"))
rawData.collect.foreach(pwp.println)
pwp.close()
用于提交作业的命令:
spark-submit --spark-conf spark.driver.userClassPathFirst=true --region us-east-1 --classname someClass somePackage-1.0-super.jar
适用于较少的数据。但由于某种原因,这项工作没有创建" / tmp / file"在群集中并在驱动程序日志中引发上述错误。有没有办法可以解决这个问题?任何想法将不胜感激。谢谢:))
答案 0 :(得分:0)
您必须调整一些VM标志:XX:MaxDirectMemorySize和Xmx
编辑 spark-defaults.conf 并修改 spark.executor.extraJavaOptions 选项以设置标记。