Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

hadoop - The root scratch dir: /tmp/hive on HDFS should be writable. Current permissions are: -wx------

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

The root scratch dir: /tmp/hive on HDFS should be writable. Current permissions are: -wx------

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();
   }
}

It is giving a runtime error for connecting hive.

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------ enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try this

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...