• 解决: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$
    

    解决

  • 相关阅读:
    继续搞我的linux
    MySQL 开始
    我的小程序终于完工
    列表页 编辑页 删除页
    开发 记账小程序研发
    vue使用饿了么element-ui框架中的上传组件进度条无法使用,:on-progress钩子无法触发的原因
    移动端调试神器vConsole
    全栈高级web前端工程师的必经之路
    在vue中使用elementUI饿了么框架使用el-tabs,切换Tab如何实现实时加载,以及el-table表格使用总结
    GitBook的使用方式,快速创建网页文档
  • 原文地址:https://www.cnblogs.com/xfly/p/6769336.html
Copyright © 2020-2023  润新知