太多的.hive-stagingxxx文件的处理

跑一段时间的HIVE程序之后,偶尔打开对应的HDFS文件夹,才发现在其目录下,产生了太多的.hive-staging_hive_date-time_ XXX文件。


仔细一看,才发现几乎每个HIVE的查询语句都会产生这样的一个文件,这种文件会随着时间积累不断增加。


这也是前段时间造成HDFS目录到项的原因之一。


查了网上的相关说明,也没有比较好的说明,可能这是基于任何一个MAP REDUCE程序都需要报告结果一样的原因。而这个文件本身是没有什么意义的。


于是采取步骤如下:


1,在hive-site.xml中,添加对其文件夹目录的配置


    hive.exec.stagingdir
    ${hive.exec.scratchdir}/${user.name}/.staging
    
      In Hive >= 0.14, set to ${hive.exec.scratchdir}/${user.name}/.staging
      In Hive < 0.14, set to ${hive.exec.scratchdir}/.staging

      You may need to manually create and/or set appropriate permissions on
      the parent dirs ahead of time.
    

2、写个.sh文件,定期对文件夹进行清理。

你可能感兴趣的:(Spark,Hive)