Thursday, July 25, 2019

Install Hive on windows: 'hive' is not recognized as an internal or external command, operable program or batch file


1
If someone is still going through this problem; here's what i did to solve hive installation on windows.
My configurations are as below (latest as of date): I am using Windows 10
  • Hadoop 2.9.1
  • derby 10.14
  • hive 2.3.4 (my hive version does not contain bin/hive.cmd; the necessary file to run hive on windows)
@wheeler above mentioned that Hive is for Linux. Here's the hack to make it work for windows. My Hive installation version did not come with windows executable files. Hence the hack!
STEP 1
There are 3 files which you need to specifically download from *https://svn.apache.org/repos/
  1. https://svn.apache.org/repos/asf/hive/trunk/bin/hive.cmd save it in your %HIVE_HOME%/bin/ as hive.cmd
  2. https://svn.apache.org/repos/asf/hive/trunk/bin/ext/cli.cmd save it in your %HIVE_HOME%/bin/ext/ as cli.cmd
  3. https://svn.apache.org/repos/asf/hive/trunk/bin/ext/util/execHiveCmd.cmd save it in your %HIVE_HOME%/bin/ext/util/ as execHiveCmd.cmd*
where %HIVE_HOME% is where Hive is installed.
STEP 2
Create tmp dir under your HIVE_HOME (on local machine and not on HDFS) give 777 permissions to this tmp dir
STEP 3
Open your conf/hive-default.xml.template save it as conf/hive-site.xml Then in this hive-site.xml, paste below properties at the top under
<property>
    <name>system:java.io.tmpdir</name>
    <value>{PUT YOUR HIVE HOME DIR PATH HERE}/tmp</value> 
    <!-- MY PATH WAS C:/BigData/hive/tmp -->
</property>
<property>
    <name>system:user.name</name>
    <value>${user.name}</value>
</property>
(check the indents)
STEP 4 - Run Hadoop services
start-dfs
start-yarn
  • Run derby
StartNetworkServer -h 0.0.0.0
Make sure you have all above services running - go to cmd for HIVE_HOME/bin and run hive command
hive

No comments:

Post a Comment