Hive 下载
[jifeng@feng03~]$ mkdir hive
[jifeng@feng03~]$cd hive/
[jifeng@feng03 hive]$ wget http://apache.fayea.com/hive/hive-1.1.1/apache-hive-1.1.1-bin.tar.gz
--2015-09-0416:34:22-- http://apache.fayea.com/hive/hive-1.1.1/apache-hive-1.1.1-bin.tar.gz
Resolvingapache.fayea.com... 119.6.56.18
Connectingto apache.fayea.com|119.6.56.18|:80... connected.
HTTPrequest sent, awaiting response... 200 OK
Length:92834839 (89M) [application/x-gzip]
Savingto: “apache-hive-1.1.1-bin.tar.gz”
100%[=======================================================================================>]92,834,839 426K/s in 5m 35s
2015-09-0416:39:57 (271 KB/s) - “apache-hive-1.1.1-bin.tar.gz” saved [92834839/92834839]
[jifeng@feng02 hive]$ tar zxf apache-hive-1.2.1-bin.tar.gz
[jifeng@feng02hive]$ ls
apache-hive-1.1.1-bin apache-hive-1.1.1-bin.tar.gz
Hive 配置
1. 环境变量
~/.bash_profile 最后加2行
[jifeng@feng03 hive]$ vi ~/.bash_profile
exportHIVE_HOME=$HOME/hive/apache-hive-1.1.1-bin
exportPATH=$PATH:$HIVE_HOME/bin
2 修改conf目录下的文件
[jifeng@feng02apache-hive-1.1.1-bin]$ cd conf
[jifeng@feng03 conf]$ ls
hive-default.xml.template hive-env.sh.template hive-exec-log4j.properties.template hive-log4j.properties.template
[jifeng@feng02 conf]$ mv hive-env.sh.template hive-env.sh
[jifeng@feng02conf]$ cp hive-default.xml.template hive-site.xml
3.修改bin目录下的文件
hive-config.sh文件最后加三行
exportJAVA_HOME=$HOME/jdk1.7.0_79
exportHIVE_HOME=$HOME/hive/apache-hive-1.1.1-bin
exportHADOOP_HOME=$HOME/hadoop-2.6.0
[jifeng@feng02 conf]$ cd ..
[jifeng@feng02apache-hive-1.1.1-bin]$ cd bin
[jifeng@feng02 bin]$ vi hive-config.sh
……
#Default to use 256MB
exportHADOOP_HEAPSIZE=${HADOOP_HEAPSIZE:-256}
exportJAVA_HOME=$HOME/jdk1.7.0_79
exportHIVE_HOME=$HOME/hive/apache-hive-1.1.1-bin
exportHADOOP_HOME=$HOME/hadoop-2.6.0
"hive-config.sh"73L, 2023C written
Hive启动
1.启动Hadoop
只启动HDFS
[jifeng@feng02 hadoop-2.6.0]$ ./sbin/start-dfs.sh
2.启动Hive
Hive启动错误
[jifeng@feng02bin]$ ./hive
Logginginitialized using configuration injar:file:/home/jifeng/hive/apache-hive-1.1.1-bin/lib/hive-common-1.1.1.jar!/hive-log4j.properties
SLF4J:Class path contains multiple SLF4J bindings.
SLF4J:Found binding in [jar:file:/home/jifeng/hadoop-2.6.0/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J:Found binding in [jar:file:/home/jifeng/hive/apache-hive-1.1.1-bin/lib/hive-jdbc-1.1.1-standalone.jar!/org/slf4j/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]
[ERROR]Terminal initialization failed; falling back to unsupported
java.lang.IncompatibleClassChangeError: Found classjline.Terminal, but interface was expected
at jline.TerminalFactory.create(TerminalFactory.java:101)
at jline.TerminalFactory.get(TerminalFactory.java:158)
at jline.console.ConsoleReader.<init>(ConsoleReader.java:229)
at jline.console.ConsoleReader.<init>(ConsoleReader.java:221)
at jline.console.ConsoleReader.<init>(ConsoleReader.java:209)
at org.apache.hadoop.hive.cli.CliDriver.getConsoleReader(CliDriver.java:773)
at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:715)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:675)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:615)
atsun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Exceptionin thread "main" java.lang.IncompatibleClassChangeError: Found classjline.Terminal, but interface was expected
at jline.console.ConsoleReader.<init>(ConsoleReader.java:230)
at jline.console.ConsoleReader.<init>(ConsoleReader.java:221)
at jline.console.ConsoleReader.<init>(ConsoleReader.java:209)
at org.apache.hadoop.hive.cli.CliDriver.getConsoleReader(CliDriver.java:773)
at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:715)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:675)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:615)
atsun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Hadoop中jline-*.jar 有三个
/home/jifeng/hadoop-2.6.0/share/hadoop/httpfs/tomcat/webapps/webhdfs/WEB-INF/lib/jline-0.9.94.jar
/home/jifeng/hadoop-2.6.0/share/hadoop/kms/tomcat/webapps/kms/WEB-INF/lib/jline-0.9.94.jar
/home/jifeng/hadoop-2.6.0/share/hadoop/yarn/lib/jline-0.9.94.jar
Hadoop中jline-*.jar版本和hive的jline-*.jar版本不一致导致,替换Hadoop中jline-*.jar,就可解决这个错误
rm-rf /home/jifeng/hadoop-2.6.0/share/hadoop/yarn/lib/jline-0.9.94.jar
cp./jline-2.12.jar /home/jifeng/hadoop-2.6.0/share/hadoop/yarn/lib
只是替换 / home/ jifeng /hadoop-2.6.0/share/ hadoop /yarn/lib这一个就好了