HDFS 主目录 [英] HDFS Home Directory

查看:69
本文介绍了HDFS 主目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了一个单节点多用户 hadoop 集群.在我的集群中,有一个负责运行集群的管理员用户(超级用户).所有其他用户都分配了一个 hdfs 目录,例如/home/xyz,其中 xyz 是用户名.

I have setup a single node multi-user hadoop cluster. In my cluster, there is an admin user that is responsible for running the cluster (superuser). All other users are allocated a hdfs directory like /home/xyz where xyz is a username.

在 unix 中,我们可以在/etc/passwd 中更改用户的默认主目录.默认情况下,用户的登陆目录是主目录.

In unix, we can change the default home directory for a user in /etc/passwd. And by default, landing directory for a user is the home directory.

我如何在 hadoop 中为 hdfs 文件系统执行此操作.例如,如果用户输入:$hadoop dfs -ls 在 unix 提示符下.它将列出我分配的主目录的内容.

How do I do it in hadoop for hdfs file system. I want for example, if user types: $hadoop dfs -ls on the unix prompt. It shall list the contents of the home directory allocated by me.

此外,hdfs 目录由运行集群的超级用户(hadoop 超级用户而不是 unix root)创建,然后将所有权转移给特定用户.

Further, hdfs directories are created by the superuser who runs the cluster(hadoop superuser and not unix root) and then transfers the ownership to a particular user.

推荐答案

我不确定这是不是可以配置的东西 - DistributedFileSystem(第 150 行)调用了似乎是硬编码的 getHomeDirectory:

I'm not sure this is something that can be configured - the source for DistributedFileSystem(line 150) has a call for getHomeDirectory that seems to be hard-coded:

@Override
public Path getHomeDirectory() {
  return makeQualified(new Path("/user/" + dfs.ugi.getShortUserName()));
}

如果您想改变这一点,您有两种可能的选择:

You do have two possible choices if you want to be able to change this:

  • 向 hadoop 提交请求以获取新功能 - 查看此链接
  • 自己修改源代码并在整个集群中重新构建 + 重新分发 hadoop-core jar(在单节点伪集群中很简单)

这篇关于HDFS 主目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆