Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: The root scratch dir: /tmp/hive on HDFS should be writable. Current permissions are: rwxrwxr-x at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:444) at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:672) at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:616) at sun.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.main(RunJar.java:160) Caused by: java.lang.RuntimeException: The root scratch dir: /tmp/hive on HDFS should be writable. Current permissions are: rwxrwxr-x at org.apache.hadoop.hive.ql.session.SessionState.createRootHDFSDir(SessionState.java:529) at org.apache.hadoop.hive.ql.session.SessionState.createSessionDirs(SessionState.java:478) at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:430) ... 7 more
如何解决?
从hive-site.xml里面找到临时目录HDFS上的路径:
<property> <name>hive.exec.scratchdir</name> <value>/tmp/hive</value> </property>
(1)先清空临时目录
hadoop fs -rm -r /tmp/hive;
(2)再赋予权限
hadoop fs -chmod 777 /tmp/hive
(3)如果本地linux系统上的tmp目录有数据,可以清空这个目录
rm -rf /tmp/hive
操作完毕后,重启hiveserver2,然后通过Hue访问,发现一切正常。
有什么问题可以扫码关注微信公众号:我是攻城师(woshigcs),在后台留言咨询。
技术债不能欠,健康债更不能欠, 求道之路,与君同行。