I have one query. It is executing fine on Hive CLI and returning the result. But when I am executing it with the help of Hive JDBC, I am getting an error below:
我有一个查询。它在CLI Hive上执行良好并返回结果。但是当我在使用Hive JDBC执行时,我得到了一个错误:
java.sql.SQLException: Query returned non-zero code: 9, cause: FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.MapRedTask
at org.apache.hadoop.hive.jdbc.HiveStatement.executeQuery(HiveStatement.java:192)
What is the problem? Also I am starting the Hive Thrift Server through Shell Script. (I have written a shell script which has command to start Hive Thrift Server) Later I decided to start Hive thrift Server manually by typing command as:
这个问题是什么?我还通过Shell脚本启动了Hive节俭服务器。(我写了一个shell脚本,里面有启动Hive Thrift Server的命令)后来我决定通过输入命令来手动启动Hive Thrift Server:
hadoop@ubuntu:~/hive-0.7.1$ bin/hive --service hiveserver
Starting Hive Thrift Server
org.apache.thrift.transport.TTransportException: Could not create ServerSocket on address 0.0.0.0/0.0.0.0:10000.
at org.apache.thrift.transport.TServerSocket.<init>(TServerSocket.java:99)
at org.apache.thrift.transport.TServerSocket.<init>(TServerSocket.java:80)
at org.apache.thrift.transport.TServerSocket.<init>(TServerSocket.java:73)
at org.apache.hadoop.hive.service.HiveServer.main(HiveServer.java:384)
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:186)
hadoop@ubuntu:~/hive-0.7.1$
Please help me out from this. Thanks
请帮助我走出困境。谢谢
2 个解决方案
#1
1
For this error :java.sql.SQLException: Query returned non-zero code: 9, cause: FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.MapRedTask at org.apache.hadoop.hive.jdbc.HiveStatement.executeQuer
对于这个错误:java.sql。查询返回非零代码:9,原因:执行错误,返回来自org.apache.hadoop.hive.ql.exec的代码2。在org.apache.hadoop.hive.jdbc.HiveStatement.executeQuer MapRedTask
Go to this link :
点击这个链接:
http://docs.amazonwebservices.com/ElasticMapReduce/latest/DeveloperGuide/UsingEMR_Hive.html
http://docs.amazonwebservices.com/ElasticMapReduce/latest/DeveloperGuide/UsingEMR_Hive.html
and add
并添加
**hadoop-0.20-core.jar
hive/lib/hive-exec-0.7.1.jar
hive/lib/hive-jdbc-0.7.1.jar
hive/lib/hive-metastore-0.7.1.jar
hive/lib/hive-service-0.7.1.jar
hive/lib/libfb303.jar
lib/commons-logging-1.0.4.jar
slf4j-api-1.6.1.jar
slf4j-log4j12-1.6.1.jar**
to the class path of your project , add this jars from the lib of hadoop and hive, and try the code. and also add the path of hadoop, hive, and hbase(if your are using) lib folder path to the project class path, like you have added the jars.
对于项目的类路径,从hadoop和hive的库中添加这个jar,并尝试代码。还可以向项目类路径添加hadoop、hive和hbase(如果您正在使用)lib文件夹路径,就像您已经添加了jar一样。
and for the second error you got
对于第二个错误
type
类型
**netstat -nl | grep 10000**
if it shows something means hive server is already running. the second error comes only when the port you are specifying is already acquired by some other process, by default server port is 10000 so very with the above netstat command which i said.
如果显示了什么,说明hive server已经在运行了。第二个错误只有当您指定的端口已经被其他进程获得时,默认的服务器端口是10000,所以非常符合上面的netstat命令。
Note : suppose you have connected using code exit from ... bin/hive of if you are connected through bin/hive > then code will not connect because i think (not sure) only one client can connect to the hive server.
注意:假设您使用代码exit from…进行连接。如果您通过bin/hive >连接,那么代码将不会连接,因为我认为(不确定)只有一个客户机可以连接到hive服务器。
do above steps hopefully will solve your problem.
完成以上步骤,希望能解决你的问题。
NOTE : exit from cli when you are going to execute the code, and dont start cli while code is being executing.
注意:在执行代码时退出cli,在执行代码时不要启动cli。
#2
1
Might be some issue with permission, just try some query like "SELECT * FROM " which won't start MR jobs.
可能会有一些权限问题,只要尝试一些诸如“SELECT * FROM”之类的查询就可以了。
#1
1
For this error :java.sql.SQLException: Query returned non-zero code: 9, cause: FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.MapRedTask at org.apache.hadoop.hive.jdbc.HiveStatement.executeQuer
对于这个错误:java.sql。查询返回非零代码:9,原因:执行错误,返回来自org.apache.hadoop.hive.ql.exec的代码2。在org.apache.hadoop.hive.jdbc.HiveStatement.executeQuer MapRedTask
Go to this link :
点击这个链接:
http://docs.amazonwebservices.com/ElasticMapReduce/latest/DeveloperGuide/UsingEMR_Hive.html
http://docs.amazonwebservices.com/ElasticMapReduce/latest/DeveloperGuide/UsingEMR_Hive.html
and add
并添加
**hadoop-0.20-core.jar
hive/lib/hive-exec-0.7.1.jar
hive/lib/hive-jdbc-0.7.1.jar
hive/lib/hive-metastore-0.7.1.jar
hive/lib/hive-service-0.7.1.jar
hive/lib/libfb303.jar
lib/commons-logging-1.0.4.jar
slf4j-api-1.6.1.jar
slf4j-log4j12-1.6.1.jar**
to the class path of your project , add this jars from the lib of hadoop and hive, and try the code. and also add the path of hadoop, hive, and hbase(if your are using) lib folder path to the project class path, like you have added the jars.
对于项目的类路径,从hadoop和hive的库中添加这个jar,并尝试代码。还可以向项目类路径添加hadoop、hive和hbase(如果您正在使用)lib文件夹路径,就像您已经添加了jar一样。
and for the second error you got
对于第二个错误
type
类型
**netstat -nl | grep 10000**
if it shows something means hive server is already running. the second error comes only when the port you are specifying is already acquired by some other process, by default server port is 10000 so very with the above netstat command which i said.
如果显示了什么,说明hive server已经在运行了。第二个错误只有当您指定的端口已经被其他进程获得时,默认的服务器端口是10000,所以非常符合上面的netstat命令。
Note : suppose you have connected using code exit from ... bin/hive of if you are connected through bin/hive > then code will not connect because i think (not sure) only one client can connect to the hive server.
注意:假设您使用代码exit from…进行连接。如果您通过bin/hive >连接,那么代码将不会连接,因为我认为(不确定)只有一个客户机可以连接到hive服务器。
do above steps hopefully will solve your problem.
完成以上步骤,希望能解决你的问题。
NOTE : exit from cli when you are going to execute the code, and dont start cli while code is being executing.
注意:在执行代码时退出cli,在执行代码时不要启动cli。
#2
1
Might be some issue with permission, just try some query like "SELECT * FROM " which won't start MR jobs.
可能会有一些权限问题,只要尝试一些诸如“SELECT * FROM”之类的查询就可以了。