Community Articles

Find and share helpful community-sourced technical articles.
Announcements
Celebrating as our community reaches 100,000 members! Thank you!
Labels (1)
avatar
Expert Contributor

Generally we are used to use chown/chmod to change permissions. When we try chown/chmod on a directory which contains some x million objects it takes very long sometime even days. So to reduce the time and make the changes in one command instead of 2 chown and chmod, you can use DistCh faster then regular chown and chmod.

Below is the command to use DistCh

hadoop jar /usr/hdp/current/hadoop-mapreduce-client/hadoop-extras.jar org.apache.hadoop.tools.DistCh 
java org.apache.hadoop.tools.DistCh [OPTIONS] <path:owner:group:permission>

The values of owner, group and permission can be empty.
Permission is a octal number.

OPTIONS:
-f <urilist_uri>       Use list at <urilist_uri> as src list
-i                     Ignore failures
-log <logdir>          Write logs to <logdir>
Generic options supported are
-conf <configuration file>     specify an application configuration file
-D <property=value>            use value for given property
-fs <local|namenode:port>      specify a namenode
-jt <local|resourcemanager:port>    specify a ResourceManager
-files <comma separated list of files>    specify comma separated files to be copied to the map reduce cluster
-libjars <comma separated list of jars>    specify comma separated jar files to include in the classpath.
-archives <comma separated list of archives>    specify comma separated archives to be unarchived on the compute machines.

1,091 Views
Comments
avatar
New Contributor

I use this tool to get a set hdfs permission https://github.com/hadoopol/hdfs_copy_permission