HDFS Home Directory

♀尐吖头ヾ 提交于 2019-11-27 19:25:22

问题


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.

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.

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.

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.


回答1:


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:

  • Submit a ticket to hadoop asking for a new feature - See this link
  • Amend the source yourself and re-build + re-distribute the hadoop-core jar across your cluster (simple in your single node pseudo cluster)



回答2:


tapan, Each user has a "home" directory in HDFS located at /user/username. For example, If you type hadoop fs -ls, it will take you the current HDFS user directory. I checked it on single with two users.

Coming to unix like file (/etc/passwd) setting, i did not know. But, it is really interesting. As chris said, we can add new feature like, introduce user-admin-site.xml like configuration file and add groups, users their permissions on directories, home directory etc. Really intertesting, we have o try this...



来源:https://stackoverflow.com/questions/10069568/hdfs-home-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!