복붙노트

[HADOOP] 루트 스크래치 디렉토리 : HDFS의 / tmp / hive는 쓰기 가능해야합니다. 현재 사용 권한은 다음과 같습니다. -wx ------

HADOOP

루트 스크래치 디렉토리 : HDFS의 / tmp / hive는 쓰기 가능해야합니다. 현재 사용 권한은 다음과 같습니다. -wx ------

hdfs 명령을 사용하여 권한을 변경했습니다. 여전히 동일한 오류를 보여줍니다.

실행중인 Java 프로그램.

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

연결 하이브에 런타임 오류가 발생했습니다.

스레드 "main"의 예외 java.lang.RuntimeException : java.lang.RuntimeException : HDFS의 루트 스크래치 디렉토리 : / tmp / hive에 쓸 수 있어야합니다. 현재 사용 권한은 다음과 같습니다. rwx ------

해결법

  1. ==============================

    1.이 시도

    이 시도

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

    하이버 쿼리를 실행하는 동안 비슷한 문제가 있었는데 -R을 사용하여 해결했습니다.

  2. ==============================

    2.이전 답변에 추가하기 위해 사용자 이름이 'cloudera'와 같은 경우 (구현 플랫폼으로 cloudera 관리자 / cloudera 빠른 시작을 사용할 수 있음) 다음을 수행 할 수 있습니다.

    이전 답변에 추가하기 위해 사용자 이름이 'cloudera'와 같은 경우 (구현 플랫폼으로 cloudera 관리자 / cloudera 빠른 시작을 사용할 수 있음) 다음을 수행 할 수 있습니다.

    hadoop에서 'hdfs'는 수퍼 유저이며 'root'또는 'cloudera'가 아닙니다.

  3. ==============================

    3.로컬 모드에서 스파크 작업을 실행 중입니다. 즉, 로컬 (Linux) 컴퓨터의 / tmp / hive 디렉토리에 대한 쓰기 권한이 없음을 의미합니다.

    로컬 모드에서 스파크 작업을 실행 중입니다. 즉, 로컬 (Linux) 컴퓨터의 / tmp / hive 디렉토리에 대한 쓰기 권한이 없음을 의미합니다.

    그러므로 chmod -R 777 / tmp / hive를 실행하십시오. 그게 내 문제를 해결했습니다.

    :::에서 참조 루트 스크래치 디렉토리 : HDFS의 / tmp / hive는 쓰기 가능해야합니다. 현재 사용 권한은 다음과 같습니다 : rwx --------- (Linux)

  4. ==============================

    4.chmod (777)하지 마십시오. 올바른 것은 (733)입니다 :

    chmod (777)하지 마십시오. 올바른 것은 (733)입니다 :

    Hive 0.14.0 이상 : Hive 작업용 HDFS 루트 스크래치 디렉토리. 쓰기 권한 (733)으로 생성됩니다. 연결하는 각 사용자에 대해 HDFS 스크래치 디렉토리 $ {hive.exec.scratchdir} /는 $ {hive.scratch.dir.permission}으로 생성됩니다.

    hdfs 사용자와 함께 이것을 시도하십시오 :

        hdfs dfs -mkdir /tmp/hive
        hdfs dfs -chown hive /tmp/hive/$HADOOP_USER_NAME
        hdfs dfs -chmod 733 /tmp/hive/$HADOOP_USER_NAME
        hdfs dfs -mkdir /tmp/hive/$HADOOP_USER_NAME
        hdfs dfs -chown $HADOOP_USER_NAME /tmp/hive/$HADOOP_USER_NAME
        hdfs dfs -chmod 700 /tmp/hive/$HADOOP_USER_NAME
    

    이 작업은 대신 하이브에서 다음과 같이 scratchdir 경로를 변경할 수 있습니다.

    set hive.exec.scratchdir=/somedir_with_permission/subdir...
    

    자세한 정보 : https://cwiki.apache.org/confluence/display/Hive/AdminManual+Configuration

  5. from https://stackoverflow.com/questions/40409838/the-root-scratch-dir-tmp-hive-on-hdfs-should-be-writable-current-permissions by cc-by-sa and MIT license