简体   繁体   中英

How to allow the root user to write files into HDFS

I have installed hadoop on Cent OS 7. The daemon service written in python trying to make a directory in HDFS , but getting the below permission error.

mkdir: Permission denied: user=root, access=WRITE, inode="/rep_data/store/data/":hadoop:supergroup:drwxr-xr-x

looks like my service is running under root account. So I would like to know how do I give a permission to the root user to make directory and write files.

If you are trying to create directory under HDFS root ie / , you may face this type of issue. You can create directories in your home, without any issues

To create directory in root, Execute command like follows

sudo hdfs hdfs dfs -mkdir /directory/name

To create directory in your HDFS home execute below command

hdfs dfs -mkdir /user/user_home/directory/name

This is probably an issue because you are not the super user .

A workaround is to enable Access Control Lists in hdfs and give permissions to your user. To enable support for ACLs, set dfs.namenode.acls.enabled to true in the NameNode configuration.

For more info check: link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM