我有Hadoop1.2.1和Hive0.14.0

jogvjijk  于 2021-05-30  发布在  Hadoop
关注(0)|答案(2)|浏览(356)

hduser@connected:~$Hive

Logging initialized using configuration in jar:file:/usr/local/hive/lib/hive-common-0.14.0.jar!/hive-log4j.properties
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: The root scratch dir: /tmp/hive on HDFS should be writable. Current permissions are: rwx--x--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: rwx--x--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)

我在hadoop中创建了配置单元目录:

hadoop fs -mkdir /usr/hive/warehouse

并设置表的权限:

hadoop fs -chmod g+w /usr/hive/warehouse

但还是不起作用?我该怎么办?

z2acfund

z2acfund1#

看起来hdfs目录/tmp/hive丢失或没有足够的权限在其中写入文件。执行以下命令以分配适当的权限。
先切换到hdfs admin user( sudo -su hdfs 命令),然后执行以下命令。

hadoop fs -chmod 777 /tmp;
hadoop fs -mkdir /tmp/hive;
hadoop fs -chmod -R 777 /tmp/hive;
ctehm74n

ctehm74n2#

检查hive-site.xml上下面标记的值,然后更改所述文件夹的权限

<property>
<name>hive.exec.local.scratchdir</name>
<value>/tmp/mydir</value>
<description>Local scratch space for Hive jobs</description>
</property>

hadoop fs -rmr /tmp/mydir;
hadoop fs -mkdir /tmp/mydir;
hadoop fs -chmod 777 /tmp/mydir;
hadoop fs -chmod -R 777 /tmp/mydir;

相关问题