本文介绍了HDFS 上的 root 临时目录:/tmp/hive 应该是可写的.当前权限为:-wx------的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已使用 hdfs 命令更改了权限.仍然显示相同的错误.

I have changed permission using hdfs command. Still it showing same error.

HDFS 上的根目录:/tmp/hive 应该是可写的.当前权限为:-wx------

我正在执行的 Java 程序.

Java Program that I am executing.

import java.sql.SQLException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.DriverManager;
import org.apache.hive.jdbc.HiveDriver;

public class HiveCreateDb {
   private static String driverName = "org.apache.hadoop.hive.jdbc.HiveDriver";

   public static void main(String[] args) throws Exception {
      // Register driver and create driver instance

         Class.forName(driverName);

/*  try {
  Class.forName(driverName);
} catch(ClassNotFoundException e) {
  print("Couldn't find Gum");

} */     // get connection

      Connection con = DriverManager.getConnection("jdbc:hive://", "", "");

      Statement stmt = con.createStatement();

      stmt.executeQuery("CREATE DATABASE userdb");
      System.out.println("Database userdb created successfully.");

      con.close();
   }
}

连接 hive 时出现运行时错误.

It is giving a runtime error for connecting hive.

线程main"中的异常 java.lang.RuntimeException: java.lang.RuntimeException: HDFS 上的根目录:/tmp/hive 应该是可写的.当前权限为:rwx------

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------

推荐答案

试试这个

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

我在运行 hive 查询时遇到了类似的问题,使用 -R 解决了它.

I had a similar issue while running a hive query, using the -R resolved it.

这篇关于HDFS 上的 root 临时目录:/tmp/hive 应该是可写的.当前权限为:-wx------的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 10:06