现象:spark 日志文件突然新增了很多.hprof文件,
查找日志spark配置参数spark_log_dir进入日志目录:
查看historyServer日志:
bash
Spark Command: /usr/lib/jvm/java-1.8.0/bin/java -cp /opt/apps/JINDOSDK/jindosdk-current/lib/*:/etc/taihao-apps/spark-conf/:/opt/apps/SPARK3/spark-current/jars/*:/etc/taihao-apps/hadoop-conf/ -XX:+ExitOnOutOfMemoryError -XX:OnOutOfMemoryError=kill -9 %p -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/taihao-apps/spark/ -Dlog4j.configuration=file:/etc/taihao-apps/spark-conf/spark-daemon-log4j.properties -Dspark.log.dir=/var/log/taihao-apps/spark -Dspark.log.file=spark-history-server.log -Xloggc:/var/log/taihao-apps/spark/spark-history-gc.log -XX:+IgnoreUnrecognizedVMOptions -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=128M -Xmx1g org.apache.spark.deploy.history.HistoryServer
========================================
java.lang.OutOfMemoryError: GC overhead limit exceeded
Dumping heap to /var/log/taihao-apps/spark/java_pid562312.hprof ...
Heap dump file created [1038934719 bytes in 4.457 secs]
#
# java.lang.OutOfMemoryError: GC overhead limit exceeded
# -XX:OnOutOfMemoryError="kill -9 %p"
# Executing /bin/sh -c "kill -9 562312"...
(END)
发现是history Server服务一直启动oom异常
重启一下:
bash
yarn --daemon start timelineserver
或者:
yarn-daemon start timelineserver
重启无效,
定位配置参数发现spark历史任务日志太多,一直没清理
修改配置参数:
bash
spark.history.fs.cleaner.enabled = true
spark_history_daemon_memory = 8g
spark_thrift_daemon_memory = 4g
成功
参考链接:
https://blog.csdn.net/Mrerlou/article/details/121405408
https://www.cnblogs.com/lemonu/p/13901203.html
https://www.cnblogs.com/nortingHome/p/13984217.html