<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question How to clean up temporary Hive folders/files in local filesystem &amp;quot;/tmp&amp;quot;? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-to-clean-up-temporary-Hive-folders-files-in-local/m-p/314708#M226147</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in our local filesystem we see thousands of subdirectories like&amp;nbsp;"????????-????-????-????-????????????_resources" older than 5 days (and this is for guarantee nothing from any still running process).&lt;/P&gt;&lt;P&gt;Additionally there are thousands of files and hundreds of subdirectories&amp;nbsp;in "/tmp/hive"&amp;nbsp;older than 5 days.&lt;/P&gt;&lt;P&gt;Where do those relicts come from?&lt;/P&gt;&lt;P&gt;How to get rid of them in an automated way?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;$ find -O1 /tmp -type d -name "????????-????-????-????-????????????_resources" -mtime +5 | wc -l
26263
$ find /tmp/hive -type d -mtime +5 | wc -l
538
$ find /tmp/hive -type f -mtime +5 | wc -l
5784&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards&lt;BR /&gt;Carsten&lt;/P&gt;</description>
    <pubDate>Thu, 15 Apr 2021 07:38:01 GMT</pubDate>
    <dc:creator>caisch</dc:creator>
    <dc:date>2021-04-15T07:38:01Z</dc:date>
    <item>
      <title>How to clean up temporary Hive folders/files in local filesystem "/tmp"?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-clean-up-temporary-Hive-folders-files-in-local/m-p/314708#M226147</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in our local filesystem we see thousands of subdirectories like&amp;nbsp;"????????-????-????-????-????????????_resources" older than 5 days (and this is for guarantee nothing from any still running process).&lt;/P&gt;&lt;P&gt;Additionally there are thousands of files and hundreds of subdirectories&amp;nbsp;in "/tmp/hive"&amp;nbsp;older than 5 days.&lt;/P&gt;&lt;P&gt;Where do those relicts come from?&lt;/P&gt;&lt;P&gt;How to get rid of them in an automated way?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;$ find -O1 /tmp -type d -name "????????-????-????-????-????????????_resources" -mtime +5 | wc -l
26263
$ find /tmp/hive -type d -mtime +5 | wc -l
538
$ find /tmp/hive -type f -mtime +5 | wc -l
5784&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards&lt;BR /&gt;Carsten&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 07:38:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-clean-up-temporary-Hive-folders-files-in-local/m-p/314708#M226147</guid>
      <dc:creator>caisch</dc:creator>
      <dc:date>2021-04-15T07:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to clean up temporary Hive folders/files in local filesystem "/tmp"?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-clean-up-temporary-Hive-folders-files-in-local/m-p/314856#M226220</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/21523"&gt;@caisch&lt;/a&gt;&amp;nbsp;&lt;SPAN&gt;The temp tables are created during the application run as intermediate data. These intermediate tables will not be removed in case the application fails and cleanup does not happen. The other reason might be if you are using beeline to run the query and if you abruptly disconnect the session without disconnecting properly by using '!q' then the file created on the '/tmp/hive' during the beeline initialisation&amp;nbsp;will not be cleared.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;To clean up the /tmp directory automatically add the&amp;nbsp;below properties in custom-hive-site.xml&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;hive.start.cleanup.scratchdir - True // To clean up the Hive scratch directory while starting the HiveServer2.

hive.server2.clear.dangling.scratchdir - true //This will start a thread in Hiveserver2 to clear out the dangling directories from the HDFS location.

hive.server2.clear.dangling.scratchdir.interval - 1800s&lt;/PRE&gt;&lt;P&gt;After adding the property kindly restart the hive service.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Reference link:&lt;/P&gt;&lt;P&gt;&lt;A href="https://cwiki.apache.org/confluence/display/Hive/Setting+Up+HiveServer2#SettingUpHiveServer2-ScratchDirectoryManagement" target="_self"&gt;https://cwiki.apache.org/confluence/display/Hive/Setting+Up+HiveServer2#SettingUpHiveServer2-ScratchDirectoryManagement&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;or you can run a cron job to delete the files periodically.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Reference Link:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;A href="https://community.cloudera.com/t5/Support-Questions/Do-we-have-any-script-which-we-can-use-to-clean-tmp-hive-dir/m-p/156965" target="_self"&gt;https://community.cloudera.com/t5/Support-Questions/Do-we-have-any-script-which-we-can-use-to-clean-tmp-hive-dir/m-p/156965&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please 'Accept as Solution' if my answers are really helpful to you.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 06:32:11 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-clean-up-temporary-Hive-folders-files-in-local/m-p/314856#M226220</guid>
      <dc:creator>shobikas</dc:creator>
      <dc:date>2021-04-19T06:32:11Z</dc:date>
    </item>
  </channel>
</rss>

