首页 技术 正文
技术 2022年11月21日
0 收藏 508 点赞 4,119 浏览 2691 个字

hdfs的权限判断十分简单,就是拿发出指令的user name和文件的user name 做比较  private void check(INode inode, FsAction access      ) throws AccessControlException {    if (inode == null) {      return;    }    FsPermission mode = inode.getFsPermission();     if (user.equals(inode.getUserName())) { //user class      if (mode.getUserAction().implies(access)) { return; }    }    else if (groups.contains(inode.getGroupName())) { //group class      if (mode.getGroupAction().implies(access)) { return; }    }    else { //other class      if (mode.getOtherAction().implies(access)) { return; }    }    throw new AccessControlException(“Permission denied: user=” + user        + “, access=” + access + “, inode=” + inode);  }} 在多用户提交任务时遇到Permission denied, 的原因和任务提交的过程有关。. 首先提交任务的客户端会把任务相关文件打包放在hadoop.tmp.dir中,这是本地目录,需要通过本地系统权限验证。由于是临时目录直接设置成为777就行.2.  客户端会将任务文件打包写入hdfs的mapreduce.jobtracker.staging.root.dir + “/” + user + “/.staging” 目录,需要经过hdfs权限验证。通常可以选择两种方法解决。1) 保持mapreduce.jobtracker.staging.root.dir为默认,将此目录chmod 7772) 在hdfs的/user目录下建立用户目录,并且chown为该用户,相当于在hdfs下创建一个用户。然后设置mapreduce.jobtracker.staging.root.dir为/user,  这是官方推荐的,可以看到这个属性的描述是这样写的:The root of the staging area for users’ job files In practice, this should be the directory where users’ home directories are located (usually /user)。3)有人说可以在启动任务时加入hadoop.job.ugi属性指定用户和群组。 我验证这样不行。看源码里也是直接获取ugi = UserGroupInformation.getCurrentUser();不过看hdfs权限策略这操行应该可以设置。 还有一些如设置dfs.permissions参数关闭权限校验,改源码直接不校验之类的。。。 最后要注意,任务的out put需要当前用户拥有权限,不然还是不成功。设置成为用户目录就好了from:http://blog.163.com/darkness@yeah/blog/static/131774484201272155937382/ 另外,关于/tmp目录也要注意: ERROR org.apache.pig.impl.io.FileLocalizer – org.apache.hadoop.security.AccessControlException: org.apache.hadoop.security.AccessControlException: Permission denied: user=shashaa, access=WRITE, inode=”tmp”:pwang7:supergroup:rwxr-xr-x 碰到这种情况,当然是使用chmod把tmp目录的权限改为777了。 关于mapreduce.jobtracker.staging.root.dir

Parameter Value Description
mapred.system.dir /var/mapr/cluster/mapred/jobTracker/system The shared directory where MapReduce stores control files.
mapred.job.tracker.persist.jobstatus.dir /var/mapr/cluster/mapred/jobTracker/jobsInfo The directory where the job status information is persisted in a file system to be available after it drops of the memory queue and between jobtracker restarts.
mapreduce.jobtracker.staging.root.dir /var/mapr/cluster/mapred/jobTracker/staging The root of the staging area for users’ job files In practice, this should be the directory where users’ home directories are located (usually /user)

启动hadoop hdfs系统的用户即为超级用户,可以进行任意的操作。 如想让leaf用户也可执行hadoop的作业,执行如下操作: 用超级用户hadoop,创建文件    hadoop fs -mkdir /user/leaf 使用hadoop fs -chown 以及-chgrp 命令改变该文件的用户和用户组权限为leaf 在配置文件hdfs-site-xml 中添加项  dfs.permissions.enabled的值为 true  要保证leaf这个用户几个节点能ssh无密码相互登录,java环境变量没问题 这样leaf用户就可以提交任务数据到HDFS的/user/leaf目录中,并且可执行hadoop任务,意如果不修改staging,任务仍旧无法提交,虽然这时候可以对hdfs的/user/leaf目录进行操作

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,961
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,485
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,330
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,113
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,746
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,780