报错信息如下:
which: no hbase in (/usr/local/sqoop-1.4.6.bin__hadoop-2.0.4-alpha/bin:/usr/local/hive/bin:/usr/local/oozie-4.1.0-cdh5.9.0/bin:/usr/local/mysql/bin:/usr/local/jdk/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/maven/bin:/usr/local/protobuf/bin:/usr/local/hadoop/bin:/usr/local/hadoop/sbin:/usr/local/scala/bin:/usr/local/spark/bin:/usr/local/curl-7.51.0/bin:/usr/local/R-3.3.1/bin:/home/hadoop//bin) SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/usr/local/apache-hive-2.1.1-bin/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/usr/local/hadoop-2.7.3/share/hadoop/common/lib/slf4j-log4j12-1.7.10.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.apache.logging.slf4j.Log4jLoggerFactory] Logging initialized using configuration in file:/usr/local/apache-hive-2.1.1-bin/conf/hive-log4j2.properties Async: true Exception in thread "main" java.lang.RuntimeException: java.io.IOException: Permission denied at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:570) at org.apache.hadoop.hive.ql.session.SessionState.beginStart(SessionState.java:531) at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:705) at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:641) 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) Caused by: java.io.IOException: Permission denied at java.io.UnixFileSystem.createFileExclusively(Native Method) at java.io.File.createTempFile(File.java:2024) at org.apache.hadoop.hive.common.FileUtils.createTempFile(FileUtils.java:798) at org.apache.hadoop.hive.ql.session.SessionState.createTempFile(SessionState.java:938) at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:568) ... 9 more
问题原因:
刚开始以为是和mysql连接问题,后来发现是文件夹无写入权限。
在hive的配置文件定义了/usr/local/hive/iotmp文件夹,使用root账号创建了该文件夹,运行hive时使用的是hadoop账号,所以导致该问题。
解决方案:
chgrp -R hadoop iotmp chown -R hadoop iotmp