zoukankan      html  css  js  c++  java
  • 解决:Permission denied at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:522)

    Permission denied at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:522)

    Logging initialized using configuration in jar:file:/opt/hive/1.2.1/lib/hive-common-1.2.1.jar!/hive-log4j.properties
    Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: java.io.IOException: Permission denied
            at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:522)
            at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:677)
            at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:621)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:606)
            at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
    Caused by: java.lang.RuntimeException: java.io.IOException: Permission denied
            at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:515)
            ... 7 more
    Caused by: java.io.IOException: Permission denied
            at java.io.UnixFileSystem.createFileExclusively(Native Method)
            at java.io.File.createNewFile(File.java:1006)
            at java.io.File.createTempFile(File.java:1989)
            at org.apache.hadoop.hive.ql.session.SessionState.createTempFile(SessionState.java:818)
            at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:513)
            ... 7 more
    myuser@namenode:/opt/hive/current/bin$
    

    尝试一:

    myuser@namenode:~$ sudo hive
    sudo: hive: command not found
    #必须到执行文件路径,sudo之后还必须指定下环境变量
    myuser@namenode:/opt/hive/current/bin$ sudo source /etc/profile ; ./hive
    

    参考
    跟在crontab中执行代码情况类似hive: command not found错误解决

    尝试二

    把hive参数hive.exec.scratchdir 设置的目录,一般为 /tmp/hive权限调整为777即可.即: chmod -R 777 /hive/tmp

    <property>
      <name>hive.exec.scratchdir</name>
      <value>/hivetest/hive</value>
      <description>HDFS root scratch dir for Hive jobs which gets created with write all (733) permission. For each connecting user, an HDFS scratch dir: ${hive.exec.scratchdir}/&lt;username&gt; is created, with ${hive.scratch.dir.pe
      rmission}.</description>
    </property>
    

    发现已经是了

    myuser@namenode:/opt/hive/current/bin$ hdfs dfs -ls  /hivetest/
    17/04/26 15:17:09 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
    Found 1 items
    drwxrwxrwx   - 777 hive          0 2017-01-10 15:44 /hivetest/hive
    

    hive错误:Exception in thread "main" java.lang.RuntimeException: java.io.IOException: Permission denied

    尝试三

    修改用户组

    usermod -a -G hive  myuser
    #检查修改
    myuser@namenode:/opt/hive/current/bin$ groups
    myuser adm cdrom sudo dip plugdev lpadmin sambashare
    
    myuser@namenode:/opt/hive/current/bin$ groups myuser
    myuser : myuser adm cdrom sudo dip plugdev lpadmin sambashare hive
    

    还是不行,报原来的错误。

    尝试四

    切换用户

    myuser@namenode:/opt/hive/current/bin$ su hive
    #密码:123456
    Password:
    hive@namenode:/opt/hive/current/bin$
    

    解决

  • 相关阅读:
    LeetCode:Validate Binary Search Tree
    二叉树的非递归遍历(非递归使用栈、非递归不使用栈)
    scala 基础语法
    scala VS python2 (linux or shell)
    web压力测试工具
    Elasticsearch cluster health: yellow unassigned shards
    GC overhead limit exceeded
    linux定时任务的设置
    linux CPU占用率高(转)
    JQuery Sparkline 说明文档
  • 原文地址:https://www.cnblogs.com/xfly/p/6769336.html
Copyright © 2011-2022 走看看