参考链接:https://blog.csdn.net/xiesai588/article/details/51317478
以上链接主要解决ERR2给出的报错信息的解决方法
软件版本信息如下:
jdk-1.8.0_161
hadoop-2.6.5
hbase-1.4.2
zookeeper-3.4.10
apache-hive-1.2.2-bin
hadoop,hbase,zookeeper集群已安装好,并启动成功,在使用hive的时候发现了一下错误,
ERR1:

shell> hive
Cannot find hadoop installation: $HADOOP_HOME or $HADOOP_PREFIX must be set or hadoop must be in the path

解决方法:
1.在修改/etc/profile文件,添加一下内容

shell>vim /etc/profile
export HIVE_HOME=/home/hadoop/hive-1.2.2/
export PATH=${JAVA_HOME}/bin:$PATH:$HADOOP_HOME/bin:$ZOOKEEPER_HOME/bin:$HBASE_HOME/bin:$HIVE_HOME/conf:$HIVE_HOME/bin:$PATH
 执行
 shell>source /etc/profile

根据错误提示信息,应该能解决问题才对的,但是此时无效,于是使用了在hive配置文件(hive-env.sh)中进行设置

 此时配置文件内容如下:
 shell>cat /home/hadoop/hive-1.2.2/conf/hive-env.sh | grep -E -v "^#|^$"

#指定hadoop的安装目录

HADOOP_HOME=/home/hadoop/hadoop-2.6.5/
export HIVE_CONF_DIR=/home/hadoop/hive-1.2.2/conf
export HIVE_AUX_JARS_PATH=/home/hadoop/hive-1.2.2/lib

测试:

hive> show tables;
OK
Time taken: 0.175 seconds

说明hive安装成功:

ERR2:执行hive报一下错误

shell>hive
18/04/04 10:59:39 WARN conf.Configuration: DEPRECATED: hadoop-site.xml found in the classpath. Usage of hadoop-site.xml is deprecated. Instead use core-site.xml, mapred-site.xml and hdfs-site.xml to override properties of core-default.xml, mapred-default.xml and hdfs-default.xml respectively

Logging initialized using configuration in jar:file:/home/hadoop/hive-1.2.2/lib/hive-common-1.2.2.jar!/hive-log4j.properties
[ERROR] Terminal initialization failed; falling back to unsupported
java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected
    at jline.TerminalFactory.create(TerminalFactory.java:101)
    at jline.TerminalFactory.get(TerminalFactory.java:158)
    at jline.console.ConsoleReader.(ConsoleReader.java:229)
    at jline.console.ConsoleReader.(ConsoleReader.java:221)
    at jline.console.ConsoleReader.(ConsoleReader.java:209)
    at org.apache.hadoop.hive.cli.CliDriver.setupConsoleReader(CliDriver.java:787)
    at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:721)
    at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:681)
    at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:621)
    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:221)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:136)

Exception in thread "main" java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected
    at jline.console.ConsoleReader.(ConsoleReader.java:230)
    at jline.console.ConsoleReader.(ConsoleReader.java:221)
    at jline.console.ConsoleReader.(ConsoleReader.java:209)
    at org.apache.hadoop.hive.cli.CliDriver.setupConsoleReader(CliDriver.java:787)
    at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:721)
    at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:681)
    at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:621)
    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:221)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:136)

错误原因:

在/hive/conf/lib目录中存在jline-x-x.jar,而/hadoop-x-x/share/hadoop/yarn/lib目录中存在老版本的jline-x-x.jar

解决办法:

将hive中新版本的jar包复制到hadoop中即可,分别为hive安装路径和hadoop安装路径

执行命令:cp /home/hive/conf/lib/jline-2-12.jar /home/hadoop-2.5.1/share/hadoop/yarn/lib/

然后重新启动hive即可

ERR3 hive命令出现问题失败
在使用show命令是总是会提示一下报错
hive> show tables;
OK
Failed with exception java.io.IOException:java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${system:user.name%7D
解决方法:
修改配置文件hive-site.xml
shell>vim /home/hadoop/hive-1.2.2/conf/hive-site.xml
原配置:

  
    hive.exec.local.scratchdir
    /home/hadoop/hive-1.2.2/iotmp/${system.user.name}
    Local scratch space for Hive jobs
  

修改后配置:

  
    hive.exec.local.scratchdir
    /home/hadoop/hive-1.2.2/iotmp/${user.name}
    Local scratch space for Hive jobs
  
保存并重启hive即可
验证:

Err1 hive安装之后启动报错解决的方法
问题解决