使用Hcatalog REST从HIve访问表

时间:2013-07-05 08:32:53

标签: hadoop hive cloudera hcatalog

我安装了带有CDH4的Hcatalog(在Ubuntu 12.04 64位上),我目前正在尝试Access Table Information with REST

我重新启动了webhcat-server service webhcat-server restart。 然后我在终端执行了这个,

curl http://localhost:50111/templeton/v1/ddl/database/?user.name=hive

我得到了,

{"databases":["default","testas"]}

如预期(并且正确)。

我试了好几次并获得了相同的输出。

然后我在浏览器中尝试了相同的操作,

{"statement":"show databases like '*';","error":"unable to show databases for: *","exec":
{"stdout":"","stderr":"Hive history file=/tmp/hive/hive_job_log_9f5d4411-e8f4-4c7e-a8db-
3bc53a565db8_2034639464.txt\nSLF4J: Class path contains multiple SLF4J bindings.\nSLF4J: 
Found binding in [jar:file:/usr/lib/zookeeper/lib/slf4j-log4j12-
1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]\nSLF4J: Found binding in 
[jar:file:/usr/lib/hive/lib/slf4j-log4j12-
1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]\nSLF4J: See 
http://www.slf4j.org/codes.html#multiple_bindings for an explanation.\n","exitcode":143}}

然后我回到终端尝试了,

curl http://localhost:50111/templeton/v1/ddl/database/?user.name=hive

现在不起作用,输出

{"statement":"show databases like '*';","error":"unable to show databases for: *","exec":
{"stdout":"","stderr":"Hive history file=/tmp/hive/hive_job_log_ce3f8d69-35b1-4617-b3a5-
624be0a500cc_268094038.txt\nSLF4J: Class path contains multiple SLF4J bindings.\nSLF4J: 
Found binding in [jar:file:/usr/lib/zookeeper/lib/slf4j-log4j12-
1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]\nSLF4J: Found binding in 
[jar:file:/usr/lib/hive/lib/slf4j-log4j12-
1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]\nSLF4J: See 
http://www.slf4j.org/codes.html#multiple_bindings for an explanation.\nOK\nFAILED: Hive 
Internal Error: java.lang.IllegalStateException(Shutdown in progress, cannot add a 
shutdownHook)\njava.lang.IllegalStateException: Shutdown in progress, cannot add a 
shutdownHook\n\tat 
org.apache.hadoop.util.ShutdownHookManager.addShutdownHook(ShutdownHookManager.java:152)\n\t
at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2352)\n\tat 
org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2324)\n\tat 
org.apache.hadoop.fs.FileSystem.get(FileSystem.java:351)\n\tat 
org.apache.hadoop.fs.Path.getFileSystem(Path.java:194)\n\tat 
org.apache.hadoop.hive.ql.Context.clear(Context.java:381)\n\tat 
org.apache.hadoop.hive.ql.Driver.close(Driver.java:1553)\n\tat 
org.apache.hcatalog.cli.HCatCli.processCmd(HCatCli.java:276)\n\tat 
org.apache.hcatalog.cli.HCatCli.processLine(HCatCli.java:205)\n\tat 
org.apache.hcatalog.cli.HCatCli.main(HCatCli.java:164)\n\tat 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)\n\tat 
sun.reflect.D","exitcode":143}}

为什么会这样?

注意:

/etc/hcatalog/proto-hive-site.xml中,我将javax.jdo.option.ConnectionPassword从之前的PASSWORD更改为密码hive

我知道有log4j错误,但我怀疑这与此

有什么关系

1 个答案:

答案 0 :(得分:0)

可能是你的类路径中有许多不同版本的slf4j jar。这是运行java程序时抛出的常见错误。请查看配置单元日志(配置单元历史文件)以获取更多信息。请尝试删除不必要的罐子版本。