Programing

명령 프롬프트에서 Hive 및 Hadoop 버전을 확인하는 방법은 무엇입니까?

crosscheck 2020. 9. 23. 07:13
반응형

명령 프롬프트에서 Hive 및 Hadoop 버전을 확인하는 방법은 무엇입니까?


명령 프롬프트에서 사용중인 Hive 버전을 어떻게 찾을 수 있습니까? 아래는 세부 사항입니다.

Putty를 사용하여 하이브 테이블에 연결하고 테이블의 레코드에 액세스합니다. 그래서 제가 한 것은 Putty를 열고 입력 한 호스트 이름을 입력 한 다음를 leo-ingesting.vip.name.com클릭하는 것 Open입니다. 그런 다음 사용자 이름과 암호를 입력 한 다음 Hive SQL에 액세스하기위한 몇 가지 명령을 입력했습니다. 아래는 내가 한 목록입니다.

$ 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;

명령 프롬프트에서 내가 사용중인 하이브 버전과 Hadoop 버전도 찾을 수있는 방법이 있습니까?


명령 줄에서 하이브 버전을 가져올 수 없습니다.

Dave가 언급 한대로 hadoop 버전을 확인할 수 있습니다.

또한 cloudera 배포를 사용하는 경우 libs를 직접 확인하십시오.

ls / usr / lib / hive / lib / 및 하이브 라이브러리 확인

hive-hwi-0.7.1-cdh3u3.jar

여기에서 호환되는 버전을 확인할 수도 있습니다.

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


$ hive --version
Hive version 0.8.1.3

편집 : 버전 앞에 또 다른 '-'를 추가했습니다. 최신 버전에서는 작동하지 않습니다. 지금 모두에게 효과가 있기를 바랍니다.

다음 배포에서 작동하는 것으로 알려져 있습니다.

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

작동하지 않습니다:

  • CDH 4.3
  • HDinsight (Azure)

$ hadoop version
Hadoop 0.20.2-cdh3u4

하지만 명령 줄에서 Hive 버전을 가져올 수 있는지 확실하지 않습니다. hive.hwi.war.file그래도 속성 과 같은 것을 사용 하거나 클래스 경로에서 가져올 수 있습니다.


hive -e "set hive.hwi.war.file;" | cut -d'-' -f3

이것은 확실히 작동합니다.

hive --version

아래는 Hadoop 2.7.2에서 작동합니다.

hive --version

hadoop version

pig --version

sqoop version

oozie version

하이브 셸에서 'set system.sun.java.command'를 실행합니다. hive-cli.jar 버전은 하이브 버전입니다.

<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>

위의 예는 CDH 버전 4.2.2 용 Hive 버전 0.10.0을 보여줍니다.


하이브 버전은

  • 리눅스 쉘 : "hive --version"
  • 하이브 쉘 : "! hive --version;"

cmds 이상은 하이브 0.13 이상에서 작동합니다.

system : sun.java.command를 설정합니다.
색조 하이브 편집기에서 하이브 버전을 제공하고 버전을 포함하는 항아리 이름을 제공합니다.


hive --version

hadoop version

명령 줄에서 버전을 가져올 수 있습니다.

hive> select version();
OK
1.1.0-cdh5.12.0 rUnknown
Time taken: 2.815 seconds, Fetched: 1 row(s)
hive>

아래 명령이 작동하며 이것을 시도하고 현재 버전을 얻었습니다.

/usr/bin/hive --version

beeline을 사용하여 하이브에 연결하는 경우 !dbinfo모든 기본 데이터베이스 세부 정보를 제공하고 출력 getDatabaseProductVersion에는 하이브 데이터베이스 버전이 있습니다.

샘플 출력 : getDatabaseProductVersion 1.2.1000.2.4.3.0-227


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

hive-metastore jar 파일의 버전을 확인하여 버전을 가져올 수도 있습니다.

예를 들면 :

$ ls /usr/lib/hive/lib/ | grep metastore
hive-metastore-0.13.1.jar

Hive 버전을 얻을 수 있습니다.

hive --version

하이브 버전 및 관련 패키지 버전을 알고 싶다면.

rpm -qa|grep hive

출력은 다음과 같습니다.

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.


Use the below command to get hive version

hive --service version


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

hive --version

Example output


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

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


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

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

/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 ~]$

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


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

참고URL : https://stackoverflow.com/questions/11302305/how-to-know-hive-and-hadoop-versions-from-command-prompt

반응형