복붙노트

[HADOOP] Windows에서 실행 - 정확히 winutils가 무엇이며 왜 필요합니까?

HADOOP

Windows에서 실행 - 정확히 winutils가 무엇이며 왜 필요합니까?

궁금해! 필자가 알고있는 HDFS는 datanode 프로세스를 실행해야하므로 이것이 서버에서만 작동하는 이유입니다. Spark은 로컬에서 실행할 수 있지만 Hadoop의 구성 요소 인 winutils.exe가 필요합니다. 하지만 정확히 무엇을합니까? 어떻게 Windows에서 Hadoop을 실행할 수 없지만 Hadoop을 기반으로하는 Spark를 실행할 수 있습니까?

해결법

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

    1.최소한 하나의 사용법을 알고 있으며, Windows OS에서 쉘 명령을 실행하기위한 것입니다. org.apache.hadoop.util.Shell에서 찾을 수 있습니다. 다른 모듈은이 클래스에 의존하며 getGetPermissionCommand () 메소드와 같은 메소드를 사용합니다.

    최소한 하나의 사용법을 알고 있으며, Windows OS에서 쉘 명령을 실행하기위한 것입니다. org.apache.hadoop.util.Shell에서 찾을 수 있습니다. 다른 모듈은이 클래스에 의존하며 getGetPermissionCommand () 메소드와 같은 메소드를 사용합니다.

    static final String WINUTILS_EXE = "winutils.exe";
    ...
    static {
      IOException ioe = null;
      String path = null;
      File file = null;
      // invariant: either there's a valid file and path,
      // or there is a cached IO exception.
      if (WINDOWS) {
        try {
          file = getQualifiedBin(WINUTILS_EXE);
          path = file.getCanonicalPath();
          ioe = null;
        } catch (IOException e) {
          LOG.warn("Did not find {}: {}", WINUTILS_EXE, e);
          // stack trace comes at debug level
          LOG.debug("Failed to find " + WINUTILS_EXE, e);
          file = null;
          path = null;
          ioe = e;
        }
      } else {
        // on a non-windows system, the invariant is kept
        // by adding an explicit exception.
        ioe = new FileNotFoundException(E_NOT_A_WINDOWS_SYSTEM);
      }
      WINUTILS_PATH = path;
      WINUTILS_FILE = file;
    
      WINUTILS = path;
      WINUTILS_FAILURE = ioe;
    }
    ...
    public static String getWinUtilsPath() {
      if (WINUTILS_FAILURE == null) {
        return WINUTILS_PATH;
      } else {
        throw new RuntimeException(WINUTILS_FAILURE.toString(),
            WINUTILS_FAILURE);
      }
    }
    ...
    public static String[] getGetPermissionCommand() {
      return (WINDOWS) ? new String[] { getWinUtilsPath(), "ls", "-F" }
                       : new String[] { "/bin/ls", "-ld" };
    }
    
  2. from https://stackoverflow.com/questions/38233228/spark-on-windows-what-exactly-is-winutils-and-why-do-we-need-it by cc-by-sa and MIT license