Pyspark作业在读取AWS EMR中包含数十亿条记录的parquet文件时失败



我试图使用两个spark sql子句从hive表中读取两个分区,并使用左外连接来获取增量,两个分区都有270亿条记录,大小为900GB,每个分区有10个文件90GB。文件格式为快捷压缩。

我在一个有28个节点的aws emr r4.16xlarge集群中运行pyspark作业。我已经尝试了各种火花配置,但每次作业与Job aborted due to stage failure: most recent failure: Lost task java.io.IOException: No space left on device失败错误

我已经尝试了各种spark配置,如果我没有错,我猜作业在工作节点中耗尽了tmp空间,我尝试设置"spark.sql.shuffle.partitions=3000"但即便如此,它还是失败了,知道我该怎么解决这个问题吗?

迄今为止尝试的spark配置

try:1
--executor-cores 5 --num-executors 335 --executor-memory 37G --driver-memory 366G
try:2
'--driver-memory 200G --deploy-mode client --executor-memory 40G --executor-cores 4 ' 
'--conf spark.dynamicAllocation.enabled=true ' 
'--conf spark.shuffle.service.enabled=true ' 
'--conf spark.executor.memoryOverhead=30g '  
'--conf spark.rpc.message.maxSize=1024 '
'--conf spark.sql.shuffle.partitions=3000 ' 
'--conf spark.sql.autoBroadcastJoinThreshold=-1 ' 
'--conf spark.driver.maxResultSize=4G '
'--conf spark.hadoop.mapreduce.fileoutputcommitter.algorithm.version=2' 
try:3
'--driver-memory 200G --deploy-mode client --executor-memory 100G --executor-cores 4 ' 
'--conf spark.dynamicAllocation.enabled=true ' 
'--conf spark.shuffle.service.enabled=true ' 

根据我使用spark的有限经验,导致此错误的原因可能是临时空间不足。您可以尝试修改spark-env.sh配置。

export SPARK_WORKER_DIR=dir_have_enough_space
export SPARK_LOCAL_DIRS=dir_have_enough_space

我使用了本文提供的解决方案,但是分配EBS卷的过程可能因引导过程的不同而有所不同

最新更新