3

I have installed Hadoop 2.7.3 on Windows and I am able to start the cluster. Now I would like to have hive and went through the steps below: 1. Downloaded db-derby-10.12.1.1-bin.zip, unpacked it and started the startNetworkServer -h 0.0.0.0.
2. Downloaded apache-hive-1.1.1-bin.tar.gz from mirror site and unpacked it. Created hive-site.xml to have below properties:

javax.jdo.option.ConnectionURL
javax.jdo.option.ConnectionDriverName
hive.server2.enable.impersonation
hive.server2.authentication
datanucleus.autoCreateTables
hive.metastore.schema.verification

I have also setup HIVE_HOME and updated path. Also set HIVE_LIB and HIVE_BIN_PATH.

When I run hive from bin I get 'hive' is not recognized as an internal or external command, operable program or batch file.

The bin/hive appears as filetype File. Please suggest. Not sure if the hive version is correct one.

Thank you.

Aavik
  • 967
  • 19
  • 48
  • I'm going to assume that you have restarted your CMD windows, since that is required for the updated `PATH` environment variable to take effect. Otherwise, do `echo %PATH%` from the command line and see if the directories that contain the `hive` binary are listed. – wheeler Mar 22 '17 at 17:06
  • yes, I restarted the cmd window – Aavik Mar 22 '17 at 17:08
  • and the path contains hive-1.1.1-bin/bin lib – Aavik Mar 22 '17 at 17:10
  • seems to me a problem with version. I am unzipping 2.1.1 and it contains hive.cmd file – Aavik Mar 22 '17 at 17:12
  • Caused by: org.datanucleus.store.rdbms.connectionpool.DatastoreDriverNotFoundExc eption: The specified datastore driver ("org.apache.derby.jdbc.ClientDriver") wa s not found in the CLASSPATH. Please check your CLASSPATH specification, and the name of the driver. – Aavik Mar 22 '17 at 17:21
  • I just tried with 2.1.1 and it worked fine. I unzipped it to my downloads and added the following path to my `PATH` environment variable: `;C:\Users\wlaw\Downloads\apache-hive-2.1.1-bin.tar\apache-hive-2.1.1-bin\bin`. I tried the same for 1.1.1, but it looks like it doesn't contain a version for windows, so you would need to use a newer version. – wheeler Mar 22 '17 at 17:32
  • Thanks. I got it working. But where will the metastore be saved, If I have to call from program. – Aavik Mar 22 '17 at 17:43
  • I am not sure about that. – wheeler Mar 22 '17 at 17:55

3 Answers3

10

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

stack_d_code
  • 1,196
  • 2
  • 12
  • 19
2

Version 1.1.1 of Apache Hive does not contain a version that can be executed on Windows (only Linux binaries):

enter image description here

However, version 2.1.1 does have Windows capabilities:

enter image description here

So even if you had your path correctly set, cmd wouldn't be able to find an executable it could run, since one doesn't exist in 1.1.1.

wheeler
  • 2,823
  • 3
  • 27
  • 43
1

i also run into this problem. to get necessary file to run hive on windows i have downloaded hive-2.3.9 and hive-3.1.2 but none of them have this files.so, we have two option:

Option 1: install hive-2.1.0 and set it up as i have tried,

Hadoop 2.8.0
derby 10.12.1.1
hive 2.1.0

Option 2: download whole bin directory and replace with yours hive bin directory. for downloading bin we need wget utility for windows. after that run this command(to understand how it works):

wget -r -np -nH --cut-dirs=3 -R index.html https://svn.apache.org/repos/asf/hive/trunk/bin/

your downloaded bin looks like: Downloaded bin directory image

after replacing it you are ready to go. so now my configurations are as below:

Hadoop 3.3.1
derby 10.13.1.1
hive 2.3.9

SidPro
  • 428
  • 1
  • 5
  • 16