HDFS 上的 root 临时目录:/tmp/hive 应该是可写的。当前权限为:rw-rw-rw-(在 Windows 上)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34196302/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 19:23:01  来源:igfitidea点击:

The root scratch dir: /tmp/hive on HDFS should be writable. Current permissions are: rw-rw-rw- (on Windows)

windowshdfs

提问by user1384205

I am running Spark on Windows 7. When I use Hive, I see the following error

我在 Windows 7 上运行 Spark。当我使用 Hive 时,我看到以下错误

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

The permissions are set as the following

权限设置如下

C:\tmp>ls -la
total 20
drwxr-xr-x    1 ADMIN Administ        0 Dec 10 13:06 .
drwxr-xr-x    1 ADMIN Administ    28672 Dec 10 09:53 ..
drwxr-xr-x    2 ADMIN Administ        0 Dec 10 12:22 hive

I have set "full control" to all users from Windows->properties->security->Advanced.

我已经从 Windows-> 属性-> 安全性-> 高级为所有用户设置了“完全控制”。

But I still see the same error. Any help please? I have checked a bunch of links, some say this is a bug on Spark 1.5. Is this true?

但我仍然看到同样的错误。请问有什么帮助吗?我检查了一堆链接,有人说这是 Spark 1.5 上的错误。这是真的?

Thanks Aarthi

谢谢 Aarthi

回答by Nishu Tayal

First of all, make sure you are using correct Winutils for your OS. Then next step is permissions.
On Windows, you need to run following command on cmd:

首先,确保您为您的操作系统使用了正确的 Winutils。然后下一步是权限。
在 Windows 上,您需要在 cmd 上运行以下命令:

D:\winutils\bin\winutils.exe chmod 777 D:\tmp\hive

Hope you have downloaded winutils already and set the HADOOP_HOMEvariable.

希望您已经下载了 winutils 并设置了HADOOP_HOME变量.

回答by Aaditya Raj

First thing first check your computer domain. Try

第一件事首先检查您的计算机域。尝试

c:\work\hadoop-2.2\bin\winutils.exe ls c:/tmp/hive

If this command says access deniedor FindFileOwnerAndPermission error (1789): The trust relationship between this workstation and the primary domain failed.

如果此命令显示拒绝访问FindFileOwnerAndPermission 错误 (1789):此工作站与主域之间的信任关系失败

It means your computer domain controller is not reachable , possible reason could be you are not on same VPN as your system domain controller.Connect to VPN and try again.

这意味着您的计算机域控制器无法访问,可能的原因可能是您与系统域控制器不在同一个 VPN 上。连接到 VPN 并重试。

Now try the solution provided by Viktor or Nishu.

现在尝试 Viktor 或 Nishu 提供的解决方案。

回答by L. Viktor

Next solution worked on Windows for me:

下一个解决方案适用于我的 Windows:

  • First, I defined HADOOP_HOME. It described in detail here
  • Next, I did like Nishu Tayal, but with one difference:C:\temp\hadoop\bin\winutils.exe chmod 777 \tmp\hive
  • 首先,我定义了 HADOOP_HOME。它在这里详细描述
  • 接下来,我确实喜欢 Nishu Tayal,但有一点不同:C:\temp\hadoop\bin\winutils.exe chmod 777 \tmp\hive

\tmp\hiveis not local directory

\tmp\hive不是本地目录

回答by OneCricketeer

You need to set this directory's permissions on HDFS, not your local filesystem. /tmpdoesn't mean C:\tmpunless you set fs.defaultFsin core-site.xml to file://c:/, which is probably a bad idea.

您需要在 HDFS 上设置此目录的权限,而不是您的本地文件系统。/tmp并不意味着C:\tmp除非您fs.defaultFs在 core-site.xml 中设置为file://c:/,这可能是个坏主意。

Check it using

检查它使用

hdfs dfs -ls /tmp 

Set it using

设置它使用

hdfs dfs -chmod 777 /tmp/hive

回答by SNK

Error while starting the spark-shell on VM running on Windows: Error msg: The root scratch dir: /tmp/hive on HDFS should be writable. Permission denied

在 Windows 上运行的 VM 上启动 spark-shell 时出错:错误消息:HDFS 上的根暂存目录:/tmp/hive 应该是可写的。没有权限

Solution: /tmp/hive is temporary directory. Only temporary files are kept in this location. No problem even if we delete this directory, will be created when required with proper permissions.

解决方案:/tmp/hive 是临时目录。此位置仅保留临时文件。即使我们删除这个目录也没有问题,需要时会以适当的权限创建。

Step 1) In hdfs, Remove the /tmp/hive directory ==> "hdfs dfs -rm -r /tmp/hive"

步骤 1) 在 hdfs 中,删除 /tmp/hive 目录 ==> "hdfs dfs -rm -r /tmp/hive"

2) At OS level too, delete the dir /tmp/hive ==> rm -rf /tmp/hive

2)在操作系统级别,删除目录 /tmp/hive ==> rm -rf /tmp/hive

After this, started the spark-shell and it worked fine..

在此之后,启动 spark-shell 并且它工作正常..

回答by Abhinandan Dubey

This is a simple 4 step process:

这是一个简单的 4 步过程:

For Spark 2.0+:

对于 Spark 2.0+:

  1. Download Hadoop for Windows / Winutils
  2. Add this to your code (beforeSparkSession initialization):

    if(getOS()=="windows"){
        System.setProperty("hadoop.home.dir", "C:/Users//winutils-master/hadoop-2.7.1"); 
    }   
    
  3. Add this to your spark-session (You can change it to C:/Tempinstead of Desktop).

    .config("hive.exec.scratchdir","C:/Users//Desktop/tmphive")
    
  4. Open cmd.exe and run:

    "path\to\hadoop-2.7.1\bin\winutils.exe" chmod 777 C:\Users\Desktop\tmphive
    
  1. 下载适用于 Windows / Winutils 的 Hadoop
  2. 将此添加到您的代码中(SparkSession 初始化之前):

    if(getOS()=="windows"){
        System.setProperty("hadoop.home.dir", "C:/Users//winutils-master/hadoop-2.7.1"); 
    }   
    
  3. 将此添加到您的 spark-session (您可以将其更改为C:/Temp而不是桌面)

    .config("hive.exec.scratchdir","C:/Users//Desktop/tmphive")
    
  4. 打开 cmd.exe 并运行:

    "path\to\hadoop-2.7.1\bin\winutils.exe" chmod 777 C:\Users\Desktop\tmphive
    

回答by Satya.pydikondala

The main reason is you started the spark at wrong directory. please create folders in D://tmp/hive (give full permissions) and start your spark in D: drive D:> spark-shell

主要原因是您在错误的目录中启动了 spark。请在 D://tmp/hive 中创建文件夹(授予完全权限)并在 D: 驱动器 D:> spark-shell 中启动你的 spark

now it will work.. :)

现在它会工作.. :)

回答by Mayank Gupta

I also faced this issue. This issue is related to network. I installed spark on Windows 7 using particular domain.

我也遇到过这个问题。此问题与网络有关。我使用特定域在 Windows 7 上安装了 spark。

Domain name can be checked

可以查域名

Start -> computer -> Right click -> Properties -> Computer name, domain and workgroup settings -> click on change -> Computer Name (Tab) -> Click on Change -> Domain name.

开始 -> 计算机 -> 右键单击​​ -> 属性 -> 计算机名、域和工作组设置 -> 点击更改 -> 计算机名(选项卡) -> 点击更改 -> 域名。

When I run spark-shell command, it works fine, without any error.

当我运行 spark-shell 命令时,它工作正常,没有任何错误。

In other networks I received write permission error. To avoid this error, run spark command on Domain specified in above path.

在其他网络中,我收到了写权限错误。为避免此错误,请在上述路径中指定的域上运行 spark 命令。

回答by Nagaraj Vittal

回答by user7735815

Issue resolved in spark version 2.0.2 (Nov 14 2016). Use this version . Version 2.1.0 Dec 28 2016 release has same issues.

问题已在 spark 2.0.2 版(2016 年 11 月 14 日)中解决。使用这个版本。2016 年 12 月 28 日发布的 2.1.0 版存在相同问题。