Hello Shashi,

HDFS itself doesn't have any knowledge of membership of users in groups.  The 
user and group field of an HDFS file or directory are just arbitrary strings.  
For consulting a user's group memberships, HDFS runs a group mapping provider 
[1].  This is pluggable, but the common case is either querying the underlying 
OS directly or querying an LDAP server.

For a given username, you can check what HDFS thinks its group memberships are 
by running the "hdfs groups" command [2].  For example:

> hdfs groups chris
chris : staff everyone localaccounts _appserverusr admin _appserveradm _lpadmin 
_appstore _lpoperator _developer com.apple.access_screensharing 
com.apple.access_ssh

However, there is no way to query a list of all users in a group through HDFS.  
HDFS doesn't have a use case for this kind of query, so it doesn't implement 
one.  For that, I'd expect you'd need to query directly whatever your group 
membership infrastructure is (i.e. run the "groups" command at the OS layer or 
query an LDAP server).

I hope this helps.

--Chris Nauroth

[1] 
http://hadoop.apache.org/docs/r2.7.2/hadoop-project-dist/hadoop-hdfs/HdfsPermissionsGuide.html#Group_Mapping
[2] 
http://hadoop.apache.org/docs/r2.7.2/hadoop-project-dist/hadoop-hdfs/HDFSCommands.html#groups


From: Shashi Vishwakarma 
<[email protected]<mailto:[email protected]>>
Date: Thursday, February 18, 2016 at 11:29 PM
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: Get member list of group in HDFS using Java/Script

Hi

I need to find how many users belong to particular group in HDFS using 
Java/Script.

Let's say I have a directory /user/data in HDFS and it belongs to a group 'abc' 
.

I need to find how may other users belongs to 'abc' group.

Can anyone suggest something.

Thanks

Reply via email to