<?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 Re: is it safe to remove the /tmp/hive/hive folder? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242618#M204419</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@Michael Bronson&lt;/A&gt;&lt;/P&gt;&lt;P&gt;To clean up the Hive scratch directory manually may not be a safe option for a multi-user environment (where multiple users might be executing the hive queries concurrently) since it will accidentally remove the scratch directory in use.&lt;/P&gt;</description>
    <pubDate>Mon, 17 Jun 2019 05:54:02 GMT</pubDate>
    <dc:creator>jsensharma</dc:creator>
    <dc:date>2019-06-17T05:54:02Z</dc:date>
    <item>
      <title>is it safe to remove the /tmp/hive/hive folder?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242610#M204411</link>
      <description>&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;is it safe to remove the &lt;STRONG&gt;/tmp/hive/hive&lt;/STRONG&gt; folder? ( from hdfs )&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;as&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;hdfs dfs -rm -r /tmp/hive/hive&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;the reason for that because under /tmp/hive/hive we have &lt;A href="https://www.google.com/search?rlz=1C1GCEU_enIL819IL819&amp;amp;q=thousand+of+files&amp;amp;spell=1&amp;amp;sa=X&amp;amp;ved=0ahUKEwi-iqiBrO7iAhXOSBUIHRSNARIQkeECCC0oAA"&gt;&lt;STRONG&gt;&lt;EM&gt;thousand&lt;/EM&gt;&lt;/STRONG&gt; &lt;/A&gt; of files &lt;STRONG&gt;and we cant delete therm &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;hdfs dfs -ls /tmp/hive/
Found 7 items
drwx------ &amp;nbsp; - admin &amp;nbsp; &amp;nbsp; hdfs &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 2019-03-05 12:00 /tmp/hive/admin
drwx------ &amp;nbsp; - drt     &amp;nbsp; hdfs &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 2019-06-16 14:02 /tmp/hive/drt
drwx------ &amp;nbsp; - ambari-qa hdfs &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 2019-06-16 15:11 /tmp/hive/ambari-qa
drwx------ &amp;nbsp; - anonymous hdfs &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 2019-06-16 08:57 /tmp/hive/anonymous
drwx------ &amp;nbsp; - hdfs &amp;nbsp; &amp;nbsp; &amp;nbsp;hdfs &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 2019-06-13 08:42 /tmp/hive/hdfs
drwx------ &amp;nbsp; - hive &amp;nbsp; &amp;nbsp; &amp;nbsp;hdfs &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 2019-06-13 10:58 /tmp/hive/hive
drwx------ &amp;nbsp; - root &amp;nbsp; &amp;nbsp; &amp;nbsp;hdfs &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 2018-07-17 23:37 /tmp/hive/root
You have mail in /var/spool/mail/root&lt;/PRE&gt;</description>
      <pubDate>Sun, 16 Jun 2019 22:47:37 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242610#M204411</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2019-06-16T22:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: is it safe to remove the /tmp/hive/hive folder?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242611#M204412</link>
      <description>&lt;P&gt;we try the following to remove files that older then 10 days  , but because there are so many files then files not deleted at all&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;hdfs dfs -ls /tmp/hive/hive &amp;nbsp; | &amp;nbsp; tr -s " " &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp;cut -d' ' -f6-8 &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; grep "^[0-9]" &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp;awk 'BEGIN{ MIN=14400; LAST=60*MIN; "date +%s" | getline NOW } { cmd="date -d'\''"$1" "$2"'\'' +%s"; cmd | getline WHEN; DIFF=NOW-WHEN; if(DIFF &amp;gt; LAST){ print "Deleting: "$3; system("hdfs dfs -rm -r "$3) }}'&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Jun 2019 22:49:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242611#M204412</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2019-06-16T22:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: is it safe to remove the /tmp/hive/hive folder?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242612#M204413</link>
      <description>&lt;P&gt;from - &lt;A href="https://stackoverflow.com/questions/44235019/delete-files-older-than-10days-on-hdfs"&gt;https://stackoverflow.com/questions/44235019/delete-files-older-than-10days-on-hdfs&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Sun, 16 Jun 2019 22:51:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242612#M204413</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2019-06-16T22:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: is it safe to remove the /tmp/hive/hive folder?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242613#M204414</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html"&gt;@Michael Bronson&lt;/A&gt;&lt;/P&gt;&lt;P&gt;As per the apache hive docs there seems to be some parameters and tools available to deal with such issue. Although i have not personally tested those tools. But looks like they were introduced to deal with similar issue long back as part of &lt;A href="https://issues.apache.org/jira/browse/HIVE-13429" target="_blank"&gt;https://issues.apache.org/jira/browse/HIVE-13429&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;For example i see that the Hive Config &lt;STRONG&gt;"hive.exec.scratchdir" &lt;/STRONG&gt;points to the&lt;STRONG&gt; "/tmp/hive" &lt;/STRONG&gt;dir&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Can you please check and let us know what is the value set for the following parameter "hive.scratchdir.lock". (if not set then default value will be "false"? Additionally you might want to refer about&lt;STRONG&gt;&lt;EM&gt; "hive.server2.clear.dangling.scratchdir" &lt;/EM&gt;&lt;/STRONG&gt;and&lt;STRONG&gt;&lt;EM&gt; "hive.start.cleanup.scratchdir"&lt;/EM&gt;&lt;/STRONG&gt; parameters of Hive Server config.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Please refer to [1] the following link to know more about those parameters.&lt;/P&gt;&lt;P&gt;There is a tool "&lt;STRONG&gt;cleardanglingscratchdir&lt;/STRONG&gt;" mentioned as part of the link [2] may be you would like to read more about it.&lt;/P&gt;&lt;PRE&gt;# hive --service cleardanglingscratchdir [-r] [-v] [-s scratchdir]
&amp;nbsp; &amp;nbsp; -r &amp;nbsp; &amp;nbsp; &amp;nbsp;dry-run mode, which produces a list on console
&amp;nbsp; &amp;nbsp; -v &amp;nbsp; &amp;nbsp; &amp;nbsp;verbose mode, which prints extra debugging information
&amp;nbsp; &amp;nbsp; -s &amp;nbsp; &amp;nbsp; &amp;nbsp;if you are using non-standard scratch directory&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;[1] &lt;A rel="noopener noreferrer noopener noreferrer noopener noreferrer noopener noreferrer noopener noreferrer" href="https://cwiki.apache.org/confluence/display/Hive/Configuration+Properties#ConfigurationProperties-hive.scratchdir.lock" target="_blank"&gt;https://cwiki.apache.org/confluence/display/Hive/Configuration+Properties#ConfigurationProperties-hive.scratchdir.lock&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;[2] &lt;A rel="noopener noreferrer noopener noreferrer noopener noreferrer noopener noreferrer noopener noreferrer noopener noreferrer" href="https://cwiki.apache.org/confluence/display/Hive/Setting+Up+HiveServer2#SettingUpHiveServer2-ClearDanglingScratchDirTool" target="_blank"&gt;https://cwiki.apache.org/confluence/display/Hive/Setting+Up+HiveServer2#SettingUpHiveServer2-ClearDanglingScratchDirTool&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 05:31:46 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242613#M204414</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2019-06-17T05:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: is it safe to remove the /tmp/hive/hive folder?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242614#M204415</link>
      <description>&lt;P&gt;@dear jay - what is the meaning of hive.scratchdir.lock  when is set to false?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 05:46:24 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242614#M204415</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2019-06-17T05:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: is it safe to remove the /tmp/hive/hive folder?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242615#M204416</link>
      <description>&lt;P&gt;second is it safe to delete the folder - &lt;/P&gt;&lt;P&gt;&lt;CODE&gt;hdfs dfs -rm -r /tmp/hive/hive&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 05:47:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242615#M204416</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2019-06-17T05:47:02Z</dc:date>
    </item>
    <item>
      <title>Re: is it safe to remove the /tmp/hive/hive folder?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242616#M204417</link>
      <description>&lt;P&gt;for your info -  actually we already delete this folder before you post your answer , and after we restart the hive service in ambari  , it create again the &lt;STRONG&gt;/tmp/hive/hive&lt;/STRONG&gt; folder &lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 05:48:45 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242616#M204417</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2019-06-17T05:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: is it safe to remove the /tmp/hive/hive folder?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242617#M204418</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@Michael Bronson&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;"hive.scratchdir.lock" :  &lt;/STRONG&gt; &lt;EM&gt;&lt;STRONG&gt;When true&lt;/STRONG&gt;&lt;/EM&gt;, holds a lock file in the scratch directory. If a Hive process dies and accidentally leaves a dangling scratchdir behind, the cleardanglingscratchdir tool will remove it.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;When false,&lt;/EM&gt;&lt;/STRONG&gt; does not create a lock file and therefore the cleardanglingscratchdir tool cannot remove any dangling scratch directories.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Regarding your query "second is it safe to delete the folder - /tmp/hive/hive"&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; I do not think that we should do it on our own. As the whole purpose of the following JIRA was to introduce some tool like "&lt;STRONG&gt;cleardanglingscratchdir&lt;/STRONG&gt;" to safely remove the scratch contents. &lt;A href="https://issues.apache.org/jira/browse/HIVE-13429" target="_blank"&gt;https://issues.apache.org/jira/browse/HIVE-13429&lt;/A&gt;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 05:51:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242617#M204418</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2019-06-17T05:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: is it safe to remove the /tmp/hive/hive folder?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242618#M204419</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@Michael Bronson&lt;/A&gt;&lt;/P&gt;&lt;P&gt;To clean up the Hive scratch directory manually may not be a safe option for a multi-user environment (where multiple users might be executing the hive queries concurrently) since it will accidentally remove the scratch directory in use.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 05:54:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242618#M204419</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2019-06-17T05:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: is it safe to remove the /tmp/hive/hive folder?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242619#M204420</link>
      <description>&lt;P&gt;@dear Jay - you said - "I do not think that we should do it on our own"  I agree but we not have a choice because under &lt;STRONG&gt;/tmp/hive/hive&lt;/STRONG&gt; we have a millions of folders and we cant delete them . so after we delete the folder from hdfs , we seen that after hive restart it create again the /tmp/hive/hive folder , do you have some advice what need to check after this brutal action ? &lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 05:59:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242619#M204420</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2019-06-17T05:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: is it safe to remove the /tmp/hive/hive folder?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242620#M204421</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@Michael Bronson&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I do not remember/think of  any specific idem to check at this point, But as long as you are able to run your Hive Queries without any issue and HiveService checks are also running fine.  I think we should be good.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 06:02:13 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242620#M204421</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2019-06-17T06:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: is it safe to remove the /tmp/hive/hive folder?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242621#M204422</link>
      <description>&lt;P&gt;@Dear KJay&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;so finally lets summary&lt;/U&gt;&lt;/P&gt;&lt;P&gt;when we set the following&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;hive.server2.clear.dangling.scratchdir=true hive.start.cleanup.scratchdir=true &lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;and then we restart the hive service from ambari&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;do you think this configuration will be able to delete the old folders under /tmp/hive/hive in spite the folder are a millions folders ?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 06:21:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242621#M204422</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2019-06-17T06:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: is it safe to remove the /tmp/hive/hive folder?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242622#M204423</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.hortonworks.com/users/26229/uribarih.html"&gt;@Michael Bronson&lt;/A&gt; &lt;/P&gt;&lt;P&gt;Yes you can delete /tmp/hive/hive if it is occupying the hdfs. Its better to schedule a script for every 15 days to cleanup the directory and enable e-mail notifications to get the alerts/warns accordingly. I tried the same in my org. due to storage crises.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2019 20:14:45 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/is-it-safe-to-remove-the-tmp-hive-hive-folder/m-p/242622#M204423</guid>
      <dc:creator>gopalt585</dc:creator>
      <dc:date>2019-06-26T20:14:45Z</dc:date>
    </item>
  </channel>
</rss>

