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

家住魔仙堡 提交于 2021-02-10 05:20:08

问题


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.


回答1:


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

However, version 2.1.1 does have Windows capabilities:

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.




回答2:


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



来源:https://stackoverflow.com/questions/42958213/install-hive-on-windows-hive-is-not-recognized-as-an-internal-or-external-com

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!