您的位置:首页 > 其它

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

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

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

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

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

于是采取步骤如下:

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

<property>
<name>hive.exec.stagingdir</name>
<value>${hive.exec.scratchdir}/${user.name}/.staging</value>
<description>
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.
</description>
</property>


2、写个.sh文件,定期对文件夹进行清理。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息