Support Questions
Find answers, ask questions, and share your expertise

Unable to run hive command

Solved Go to solution

Unable to run hive command

Explorer

Hi Folks,

I receive an error while running hive command. All the hive services are running fine.

Please see the log below and help me to fix this issue.

Note : tez.lib.uris of tez and hive are same.

$ hive log4j:WARN No such property [maxFileSize] in org.apache.log4j.DailyRollingFileAppender. Logging initialized using configuration in file:/etc/hive/2.6.1.0-129/0/hive-log4j.properties Exception in thread "main" java.lang.RuntimeException: java.io.FileNotFoundException: File does not exist: /usr/hdp/2.6.1.0-129/tez/lib/tez.tar.gz at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:560) at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:681) at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:625) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.hadoop.util.RunJar.run(RunJar.java:233) at org.apache.hadoop.util.RunJar.main(RunJar.java:148) Caused by: java.io.FileNotFoundException: File does not exist: /usr/hdp/2.6.1.0-129/tez/lib/tez.tar.gz at org.apache.hadoop.hdfs.DistributedFileSystem$26.doCall(DistributedFileSystem.java:1446) at org.apache.hadoop.hdfs.DistributedFileSystem$26.doCall(DistributedFileSystem.java:1438) at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81) at org.apache.hadoop.hdfs.DistributedFileSystem.getFileStatus(DistributedFileSystem.java:1438) at org.apache.hadoop.fs.FileSystem.resolvePath(FileSystem.java:770) at org.apache.tez.client.TezClientUtils.getLRFileStatus(TezClientUtils.java:130) at org.apache.tez.client.TezClientUtils.setupTezJarsLocalResources(TezClientUtils.java:181) at org.apache.tez.client.TezClient.getTezJarResources(TezClient.java:831) at org.apache.tez.client.TezClient.start(TezClient.java:355) at org.apache.hadoop.hive.ql.exec.tez.TezSessionState.open(TezSessionState.java:197) at org.apache.hadoop.hive.ql.exec.tez.TezSessionState.open(TezSessionState.java:116) at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:557) ... 8 more

$ locate /usr/hdp/2.6.1.0-129/tez/lib/tez.tar.gz

/usr/hdp/2.6.1.0-129/tez/lib/tez.tar.gz

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Unable to run hive command

Mentor

@Saravana V

Hive CLI is deprecated HiveServer2 in Hadoop 2.0 introduced its own CLI called Beeline, which is a JDBC client based on SQLLine. Due to new development being focused on HiveServer2, Hive CLI will soon be deprecated in favor of Beeline.

To use the new Hive CLI on top of Beeline to implement the Hive CLI functionality set

export USE_DEPRECATED_CLI=false 

I came across a case where ATLAS doesn't see objects (database or tables) created from Hive CLI so try using the beeline at the console type

$ beeline 
$ ! connect jdbc:hive2://{hive_host}:10000/{database} 

You will be prompted for the username and the password.

View solution in original post

6 REPLIES 6

Re: Unable to run hive command

Super Collaborator

might be stupid, but did you check the file permissions? Has the user running the hive command permissions on the file?

Re: Unable to run hive command

Explorer
@Harald Berghoff

I'm running the hive command from hive user ID. And yes it has full permission for hive user.

[~] $ ls -l /usr/hdp/2.6.1.0-129/tez/lib/tez.tar.gz

-rwxrwxr-x 1 hive hadoop 51303070 May 31 2017 /usr/hdp/2.6.1.0-129/tez/lib/tez.tar.gz

Re: Unable to run hive command

Super Collaborator

i guess your run from the shell just the command 'hive'? And your are doing this being logged in to the shell as the user 'hive'?

Re: Unable to run hive command

Mentor

@Saravana V

Hive CLI is deprecated HiveServer2 in Hadoop 2.0 introduced its own CLI called Beeline, which is a JDBC client based on SQLLine. Due to new development being focused on HiveServer2, Hive CLI will soon be deprecated in favor of Beeline.

To use the new Hive CLI on top of Beeline to implement the Hive CLI functionality set

export USE_DEPRECATED_CLI=false 

I came across a case where ATLAS doesn't see objects (database or tables) created from Hive CLI so try using the beeline at the console type

$ beeline 
$ ! connect jdbc:hive2://{hive_host}:10000/{database} 

You will be prompted for the username and the password.

View solution in original post

Re: Unable to run hive command

Explorer

@Geoffrey Shelton Okot Thanks for your comment. beeline does work for me.

I just want to understand, Do you mean the hive CLI is no more? I should use beeline instead of hive command and on which user ID I should set the value

export USE_DEPRECATED_CLI=false

Re: Unable to run hive command

Mentor

@Saravana V

In the below I used the hive user and password, Access to HiveServer2 in kerberized cluster using hive CLI has been deprecated. Example One

$ beeline 
$ ! connect jdbc:hive2://{hive_host}:10000/test 

Here you MUST be the test database owner as you will be prompted for username / password see below prompts

Hs2 in kerberized cluster

Note the hive principal and REALM

$ beeline 
Beeline version 1.2.1000.2.5.3.0-37 by Apache Hive 
beeline> ! connect jdbc:hive2://france.paris.fr:10000/;principal=hive/france.paris.fr@PARIS.FR 
Connecting to jdbc:hive2://france.paris.fr:10000/;principal=hive/france.paris.fr@PARIS.FR 

Will be prompted for username/password

Enter username for jdbc:hive2://france.paris.fr:10000/;principal=hive/france.paris.fr@PARIS.FR:{username} 
Enter password for jdbc:hive2://france.paris.fr:10000/;principal=hive/france.paris.fr@PARIS.FR:{password} 
Connected to: Apache Hive (version 1.2.1000.2.5.3.0-37) 
Driver: Hive JDBC (version 1.2.1000.2.5.3.0-37) 
Transaction isolation: TRANSACTION_REPEATABLE_READ 
0: jdbc:hive2://france.paris.fr:10000/> show databases; 
+----------------+ 
| database_name  | 
+----------------+ 
| default  | 
| agricole | 
| achats   | 
+----------------+--+ 
3 rows selected (2.863 seconds) 
0: jdbc:hive2://london.nakuru.com:10000> use agricole;