Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Retrieving HDFS Groups and users using programming

avatar
Explorer

Hello,

Is there a way to retrieve all HDFS groups and respective users, in Cloudera, using Java or Scala/Spark code?

In other words, I’m looking for Java/Scala code equivalent to "hdfs groups <user1>, <user2>, ...".

Ideally, the code would run in Zeppelin.

Many thanks.

 

1 ACCEPTED SOLUTION

avatar
Cloudera Employee

Try this

hdfs groups hdfs solr

View solution in original post

3 REPLIES 3

avatar
Cloudera Employee

@phir1 
I can think of something like a for maybe:
# for i in `cat <users_file>`; do hdfs groups $i; done

avatar
Explorer

Hi,

thank you for your suggestion, but I’m looking for example Java or Scala code that uses the Hadoop or Cloudera API, instead of scripting the « hdfs » tool on Linux.

avatar
Cloudera Employee

Try this

hdfs groups hdfs solr