102

How can I find which Hive version I am using from the command prompt. Below is the details-

I am using Putty to connect to hive table and access records in the tables. So what I did is- I opened Putty and in the host name I typed- leo-ingesting.vip.name.com and then I click Open. And then I entered my username and password and then few commands to get to Hive sql. Below is the list what I did

$ bash
bash-3.00$ hive
Hive history file=/tmp/rkost/hive_job_log_rkost_201207010451_1212680168.txt
hive> set mapred.job.queue.name=hdmi-technology;
hive> select * from table LIMIT 1;

So is there any way from the command prompt I can find which hive version I am using and Hadoop version too?

Jacek Laskowski
  • 72,696
  • 27
  • 242
  • 420
arsenal
  • 23,366
  • 85
  • 225
  • 331
  • 1
    Can I make a request that *every* single CLI in the world start supporting -v, --v, -version, and --version as aliases for each other so we can all just get on with our lives. – jarmod Dec 22 '17 at 19:20
  • 1
    you can't: gnu getopt would consider -version as -v -e -r -s -i -o -n, for example. Also, proper CLI uses -v as alias for --verbose. – Konstantin Svintsov Oct 24 '19 at 09:44

25 Answers25

158
$ hive --version
Hive version 0.8.1.3

EDIT: added another '-' before the version. Doesn't work for newer versions. Hope it works for all now.

Known to work in the following distributions:

  • HortonWorks distribution: $ hive --version Hive 0.14.0.2.2.0.0-2041
  • CDH 5.3

It does not work:

  • CDH 4.3
  • HDinsight (Azure)
Jacek Laskowski
  • 72,696
  • 27
  • 242
  • 420
dfrankow
  • 20,191
  • 41
  • 152
  • 214
  • 2
    I have no idea why someone downvoted this, but it works for me. Maybe it is specific to Amazon Elastic MapReduce (EMR), or to the Hive version. – dfrankow May 11 '13 at 21:02
  • 1
    I have cloudera 5.11. Worked fine for me – jony70 Jun 18 '19 at 17:50
  • CDH 5.15, worked for me. Java HotSpot(TM) 64-Bit Server VM warning: ... Hive 1.1.0-cdh5.15.2 I don't know why this answer is on the second, not first position – staticor Dec 30 '19 at 07:05
47
$ hadoop version
Hadoop 0.20.2-cdh3u4

Not sure you can get the Hive version from the command line, though. Maybe you could use something like the hive.hwi.war.file property or pull it out of the classpath, though.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302
  • Thanks Dave, It worked. I am asking this question since I am trying to Access Hive metadata using SQL Client. But somehow I am not able to do it. I posted the question here. Can you please take a look into this `http://stackoverflow.com/questions/11278040/access-hive-tables-in-sqlclient-but-not-from-the-putty`. Any help will be appreciated. – arsenal Jul 03 '12 at 00:14
  • @RaihanJamal I have no idea; I've never tried using anything like that with Hive. – Dave Newton Jul 03 '12 at 00:16
38

You can not get hive version from command line.

You can checkout hadoop version as mentioned by Dave.

Also if you are using cloudera distribution, then look directly at the libs:

ls /usr/lib/hive/lib/ and check for hive library

hive-hwi-0.7.1-cdh3u3.jar

You can also check the compatible versions here:

http://www.cloudera.com/content/cloudera/en/documentation/cdh5/v5-1-x/CDH-Version-and-Packaging-Information/CDH-Version-and-Packaging-Information.html

Afshin Moazami
  • 2,092
  • 5
  • 33
  • 55
pyfunc
  • 65,343
  • 15
  • 148
  • 136
  • 2
    Are you sure the path is `/usr/lib/hive/lib/` ? – arsenal Jul 03 '12 at 00:18
  • @RaihanJamal: Yes if you are using cloudera distribution. :) – pyfunc Jul 03 '12 at 00:20
  • Ok. got it. `hive-0.6 I have`. I am asking this question since I am trying to Access Hive metadata using SQL Client. But somehow I am not able to do it. I posted the question here. Can you please take a look into this http://stackoverflow.com/questions/11278040/access-hive-tables-in-sqlclient-but‌​-not-from-the-putty. Any help will be appreciated. – arsenal Jul 03 '12 at 00:24
  • 1
    yes you can get it from commande line : hive -e "set hive.hwi.war.file;" |grep hwi| cut -d'-' -f3 – David Aug 03 '12 at 18:06
  • 1
    I am getting "hive.hwi.war.file is undefined" – rajibdotnet May 09 '14 at 18:56
  • @pyfunc What about HDP? – xxks-kkk Mar 17 '16 at 05:38
  • 10
    hive --version shows the version. `[root@mysupercomputer ~]# hive --version` `Hive 1.2.1` `Subversion git://localhost.localdomain/home/sush/dev/hive.git -r 243e7c1ac39cb7ac8b65c5bc6988f5cc3162f558` `Compiled by sush on Fri Jun 19 02:03:48 PDT 2015 From source with checksum ab480aca41b24a9c3751b8c023338231` – Sridhar Apr 17 '17 at 08:14
24

You CAN get version from command line(hive or beeline).

hive> select version();
OK
1.1.0-cdh5.12.0 rUnknown
Time taken: 2.815 seconds, Fetched: 1 row(s)
hive>
Konstantin Svintsov
  • 1,607
  • 10
  • 25
  • 1
    I got FAILED: SemanticException [Error 10011]: Line 1:7 Invalid function 'version' – Ganesh Feb 19 '21 at 13:45
  • @Ganesh Chances are your hive version is not sufficiently recent. Check out https://issues.apache.org/jira/browse/HIVE-12983 – Suhkjin Hur May 21 '21 at 02:06
15

The below works on Hadoop 2.7.2

hive --version

hadoop version

pig --version

sqoop version

oozie version
FelixSFD
  • 6,052
  • 10
  • 43
  • 117
viru
  • 2,081
  • 19
  • 23
14

This should certainly work:

hive --version
slm
  • 15,396
  • 12
  • 109
  • 124
Manas Jani
  • 699
  • 2
  • 11
  • 33
13
hive -e "set hive.hwi.war.file;" | cut -d'-' -f3
David
  • 1,842
  • 2
  • 21
  • 31
11

Use the version flag from the CLI

[hadoop@usernode~]$ hadoop version
Hadoop 2.7.3-amzn-1
Subversion git@aws157git.com:/pkg/Aws157BigTop -r d94115f47e58e29d8113a887a1f5c9960c61ab83
Compiled by ec2-user on 2017-01-31T19:18Z
Compiled with protoc 2.5.0
From source with checksum 1833aada17b94cfb94ad40ccd02d3df8
This command was run using /usr/lib/hadoop/hadoop-common-2.7.3-amzn-1.jar


[hadoop@usernode ~]$ hive --version
Hive 1.0.0-amzn-8
Subversion git://ip-20-69-181-31/workspace/workspace/bigtop.release-rpm-4.8.4/build/hive/rpm/BUILD/apache-hive-1.0.0-amzn-8-src -r d94115f47e58e29d8113a887a1f5c9960c61ab83
Compiled by ec2-user on Tue Jan 31 19:51:34 UTC 2017
From source with checksum 298304aab1c4240a868146213f9ce15f
Savio D'Souza
  • 201
  • 3
  • 6
9

From the hive shell issue 'set system.sun.java.command' The hive-cli.jar version is the hive version.

<code>
hive> set system:sun.java.command;
system:sun.java.command=org.apache.hadoop.util.RunJar /opt/cloudera/parcels/CDH-4.2.2-1.cdh4.2.2.p0.10/bin/../lib/hive/lib/hive-cli-**0.10.0**-cdh**4.2.2**.jar org.apache.hadoop.hive.cli.CliDriver
hive> 
</code>

The above example shows Hive version 0.10.0 for CDH version 4.2.2

Jitesh Prajapati
  • 2,533
  • 4
  • 29
  • 51
Jai Prakash
  • 2,461
  • 1
  • 26
  • 27
8
hive --version

hadoop version
MysticForce
  • 1,253
  • 1
  • 16
  • 27
7

We can find hive version by

  • on linux shell : "hive --version"
  • on hive shell : " ! hive --version;"

above cmds works on hive 0.13 and above.

Set system:sun.java.command;
gives the hive version from hue hive editor it gives the the jar name which includes the version.

Som
  • 91
  • 1
  • 10
6

to identify hive version on a EC2 instance use

hive --version
Arun Mohan
  • 349
  • 4
  • 13
5

Below command works , i tried this and got the current version as

/usr/bin/hive --version
Jerry Jeremiah
  • 9,045
  • 2
  • 23
  • 32
Navneet Kumar
  • 3,732
  • 2
  • 18
  • 25
4

If you are using beeline to connect to hive, then !dbinfo will give all the underlying database details and in the output getDatabaseProductVersion will have the hive database version.

Sample output: getDatabaseProductVersion 1.2.1000.2.4.3.0-227

venkata
  • 447
  • 3
  • 15
3

If you are using hortonworks distro then using CLI you can get the version with the command:

hive --version

Example output

Rob Quincey
  • 2,834
  • 2
  • 38
  • 54
jarvis_max
  • 177
  • 1
  • 12
2

We can also get the version by looking at the version of the hive-metastore jar file.

For example:

$ ls /usr/lib/hive/lib/ | grep metastore
hive-metastore-0.13.1.jar
Pratik Khadloya
  • 12,509
  • 11
  • 81
  • 106
2

You can get Hive version

hive --version

if you want to know hive version and its related package versions.

rpm -qa|grep hive

Output will be like below.

libarchive2-2.5.5-5.19
hive-0.13.0.2.1.2.2-516
perl-Archive-Zip-1.24-2.7
hive-jdbc-0.13.0.2.1.2.2-516
webhcat-tar-hive-0.13.0.2.1.2.2_516-2
hive-webhcat-0.13.0.2.1.2.2-516
hive-hcatalog-0.13.0.2.1.2.2-516

Latter gives better understanding of hive and its dependents. Nevertheless rpm needs to be present.

Balaswamy Vaddeman
  • 8,360
  • 3
  • 30
  • 40
2

Use the below command to get hive version

hive --service version

Karthik Sridhar
  • 239
  • 1
  • 6
2

From your SSH connection to edge node, you can simply type

hive --version

Hive 1.2.1000.x.x.x.x-xx

This returns the Hive version for your distribution of Hadoop. Another approach is if you enter into beeline, you can find the version straight away.

beeline
Beeline version 1.2.1000.x.x.x.x-xx by Apache Hive
Piyush Patel
  • 1,646
  • 1
  • 14
  • 26
1

another way is to make a REST call, if you have WebHCat (part of Hive project) installed, is

curl -i http://172.22.123.63:50111/templeton/v1/version/hive?user.name=foo

which will come back with JSON like

{"module":"hive","version":"1.2.1.2.3.0.0-2458"}

WebHCat docs has some details

Eugene
  • 826
  • 1
  • 7
  • 7
1

Yes you can get version of your hive by using "hive command":

hive --service version

You can get a list of available service names by using following "hive command":

hive --service help
gre_gor
  • 6,669
  • 9
  • 47
  • 52
Seema Pal
  • 11
  • 2
0

you can look for the jar file as soon as you login to hive

jar:file:/opt/mapr/hive/hive-0.12/lib/hive-common-0.12-mapr-1401-140130.jar!/hive-log4j.properties
Carl0s1z
  • 4,683
  • 7
  • 32
  • 47
Shanu
  • 11
  • 3
0

/usr/bin/hive --version worked for me.

[qa@ip-10-241-1-222 ~]$ /usr/bin/hive --version
Hive 0.13.1-cdh5.3.1
Subversion file:///data/1/jenkins/workspace/generic-package-rhel64-6-0/topdir/BUILD/hive-0.13.1-cdh5.3.1 -r Unknown
Compiled by jenkins on Tue Jan 27 16:38:55 PST 2015
From source with checksum 1bb86e4899928ce29cbcaec8cf43c9b6
[qa@ip-10-241-1-222 ~]$
0

On HDInsight I tried the hive --version, but it did not recognize the option or mention it in the help.

D:\Users\admin1>%hive_home%/bin/hive --version
Unrecognized option: --version
usage: hive
 -d,--define <key=value>          Variable subsitution to apply to hive
                                  commands. e.g. -d A=B or --define A=B
    --database <databasename>     Specify the database to use
 -e <quoted-query-string>         SQL from command line
 -f <filename>                    SQL from files
 -H,--help                        Print help information
 -h <hostname>                    connecting to Hive Server on remote host
    --hiveconf <property=value>   Use value for given property
    --hivevar <key=value>         Variable subsitution to apply to hive
                                  commands. e.g. --hivevar A=B
 -i <filename>                    Initialization SQL file
 -p <port>                        connecting to Hive Server on port number
 -S,--silent                      Silent mode in interactive shell
 -v,--verbose                     Verbose mode (echo executed SQL to the
                                  console)

However when you login to the head node and start the hive console it prints out some helpful configuration information from which the version can be read:

D:\Users\admin1>%hive_home%/bin/hive 
Logging initialized using configuration in file:/C:/apps/dist/hive-0.13.0.2.1.11.0-2316/conf/hive-log4j.properties
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/apps/dist/hadoop-2.4.0.2.1.11.0-2316/share/hadoop/common/lib/slf4j-log4j12-1.7.5.j
ar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/apps/dist/hbase-0.98.0.2.1.11.0-2316-hadoop2/lib/slf4j-log4j12-1.6.4.jar!/org/slf4
j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
hive> quit;

From this I would say I have Hive version 0.13 deployed, which is consistent with this list of versions https://hive.apache.org/downloads.html

Mike Wise
  • 22,131
  • 8
  • 81
  • 104
0

I was able to get the version of installed Hadoop 3.0.3 by the following command
$HADOOP_HOME/bin$ ./hadoop version
which gave me the following output

Hadoop 3.0.3
Source code repository https://yjzhangal@git-wip-us.apache.org/repos/asf/hadoop.git -r 37fd7d752db73d984dc31e0cdfd590d252f5e075
Compiled by yzhang on 2018-05-31T17:12Z
Compiled with protoc 2.5.0
From source with checksum 736cdcefa911261ad56d2d120bf1fa
This command was run using /usr/local/hadoop/share/hadoop/common/hadoop-common-3.0.3.jar