Spark 任务报错:
org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.hdfs.protocol.FSLimitException$MaxDirectoryItemsExceededException): The directory item limit of /spark-history is exceeded: limit=1048576 items=1048576
报错截图:
短期解决方案:
hdfs-site.xml 调大 dfs.namenode.fs-limits.max-directory-items为3200000,若没有则新增,滚动重启 NameNode。
长期解决方案:
查看hdfs://spark-history文件数增长原因,发现 spark-history 配置spark.history.fs.cleaner.enabled为false,将其调整为true并重启spark history server,过期数据会根据spark.history.fs.cleaner.maxAge、spark.history.fs.cleaner.interval配置规则进行删除