以下是本人hive的安裝過程:
hive 是Hadoop中最常用的工具,可以說是必裝工具。
按apache官方文檔,推薦使用svn下載後編譯,文檔位址:HTTPs://cwiki.apache.org/confluence/display/Hive/AdminManual+Installation
但build時,因為依賴關係,整了很久,下了很多包也沒有成功。
推薦使用tar.gz包,直接安裝,文檔位址:HTTPs://cwiki.apache.org/confluence/display/Hive/GettingStarted# GettingStarted-InstallationandConfiguration
很簡單,直接成功!
首次運行hive時報錯:
Exception in thread "main" java.lang.NoSuchFieldError: ALLOW_UNQUOTED_CONTROL_CHARS at org.apache.hadoop.hive.ql.udf.generic.GenericUDTFJSONTuple.<clinit>(GenericUDTFJSONTuple.java:59) at sun.reflect.820.html">NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:113) at org.apache.hadoop.hive.ql.exec.FunctionRegistry.registerGenericUDTF(FunctionRegistry.java:545) at org.apache.hadoop.hive.ql.exec.FunctionRegistry.registerGenericUDTF(FunctionRegistry.java:539) at org.apache.hadoop.hive.ql.exec.FunctionRegistry.<clinit>(FunctionRegistry.java:472) at org.apache.hadoop.hive.ql.session.SessionState.<init>(SessionState.java:202) at org.apache.hadoop.hive.cli.CliSessionState.<init>(CliSessionState.java:86) at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:635) at org.apache.hadoop.hive.cli.CliDriver.main( CliDriver.java:613) 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:156)
ALLOW_UNQUOTED_CONTROL_CHARS是關鍵字
原因:
hive 裡的 jackson jar 包 和 hadoop 裡的不一致, hadoop 裡的用的是老的 1.0.1 的, hive 裡的是 1.8.8.
將hadoop 裡的jar 替換成和 hive 一樣的就ok了,
找不到jar包的可以find一下。