[HOW TO] Install Apache Hive

Important: I have made a complete screencast demonstrating the installation of Apache Hive. You can find it at Hadoop Screencasts – Episode 4: Installing Apache Hive. You can ignore the post below and follow the instructions on the screencast.

Environment Details
Operating System : Linux Mint Release 14
Hadoop Version : 0.20.2

Following are the steps to install Apache Hive:

  • Download Apache Hive

$ wget http://apache.mirrors.hoobly.com/hive/hive-0.10.0/hive-0.10.0.tar.gz

  • Untar the archive. I have untarred the file to the /usr/local/

$ tar -xzvf hive-0.10.0.tar.gz
$ mv hive-0.10.0 hive

  • Set the environment variable HIVE_HOME to point to the installation directory:

$ cd hive
$ export HIVE_HOME=/usr/local/hive

  • Add $HIVE_HOME/bin to your PATH:

$ export PATH=$HIVE_HOME/bin:$PATH
$ hive

Do let me know if you need any information.

14 Comments [HOW TO] Install Apache Hive

  1. Pingback: JavaPins

  2. Ajay

    Thanks for the post. I have followed the steps, but getting the following error…Could you pls provide the solution for this.
    Exception in thread “main” java.lang.NoSuchFieldError: ALLOW_UNQUOTED_CONTROL_CHARS
    at org.apache.hadoop.hive.ql.udf.generic.GenericUDTFJSONTuple.(GenericUDTFJSONTuple.java:59)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:113)
    at org.apache.hadoop.hive.ql.exec.FunctionRegistry.registerGenericUDTF(FunctionRegistry.java:545)
    at org.apache.hadoop.hive.ql.exec.FunctionRegistry.registerGenericUDTF(FunctionRegistry.java:539)
    at org.apache.hadoop.hive.ql.exec.FunctionRegistry.(FunctionRegistry.java:472)
    at org.apache.hadoop.hive.ql.session.SessionState.(SessionState.java:202)
    at org.apache.hadoop.hive.cli.CliSessionState.(CliSessionState.java:86)
    at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:635)
    at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:613)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:156)

    Reply
    1. Mukesh Kumar

      I had the same problem. There is an open issue with this. See this link https://issues.apache.org/jira/browse/HIVE-3607
      I also tried downloading the latest Hive build, but, it couldn’t solve the problem straightaway. I didn’t want to waste much of my time.

      Solution:
      Install a later version of hadoop. If you want to stick to the hadoop having similar directory structure so that you don’t have to do much changes to configurations you did for hadoop-0.20.x, then try installing http://mirrors.ibiblio.org/apache/hadoop/common/hadoop-1.2.1/hadoop-1.2.1.tar.gz with similar steps.

      Actual Problem:
      “When queries are actually run in a Hadoop cluster, Hive’s jars are appended to Hadoop’s classpath. However, when we test/run jobs locally Hive’s classpath comes first. This leads to issues like the one brought up here after the patch was committed HIVE-3581 where a change depended on a jar Hive includes which conflicted with one provided by Hadoop which is an older version in 0.20.
      It’s possible that more of the jars we include are getting preceded by older jars in Hadoop, and we haven’t noticed yet.
      If we add Hive jars to the beginning of Hadoop’s classpath we will be in control in such situations where the jars are backwards compatible. We will be able to update the jars in Hive and these will be used at run time, instead of just compile time.”

      Reply
  3. Ravi Khatana

    Hi Rohit,

    I installed it successfully but when I run it it throwing error
    “Error: Could not find or load main class org.apache.hadoop.util.VersionInfo
    Unable to determine Hadoop version information.
    ‘hadoop version’ returned:
    Error: Could not find or load main class org.apache.hadoop.util.VersionInfo”

    I haved installed hadoop-1.2.1 and hive-0.11.0

    Thanks in advance
    Ravi

    Reply
  4. sami

    hi Rohit
    i’m using linux ubuntu 13.04 desktop, hadoop 0.23.9 and hive 0.10.0.
    i follw the steps and i have this errors:
    1.some times (the command hive not found)
    Or 2.(I should set hadoop home…)

    thanks

    Reply
  5. Thodime

    Hi Rohit,

    I tried couple of times to run the hive but , i am getting the below error, can u help me

    Exception in thread “main” java.io.IOException: Mkdirs failed to create /home/hadoop/tmp
    at org.apache.hadoop.util.RunJar.ensureDirectory(RunJar.java:111)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:155)

    I am using The below versions
    Ubuntu 13.04 desktop, hadoop 0.23.9 and hive 0.10.0.

    Thanks,
    Thodime.

    Reply
  6. xuyen le

    hi rohit,
    i installed and run the first time succes but after i restart hive. i got error:
    FAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
    FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

    Thanks

    Reply
  7. Hemant

    Hi
    I am trying
    “hive > select * from sales;”
    i got follwing error

    Failed with exception java.io.IOException:java.net.ConnectException: Call to localhost/127.0.0.1:8020 failed on connection exception: java.net.ConnectException: Connection refused

    Please get me out of this.
    Thanks

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *