TECHIES WORLD

For Techs.... Techniques.... Technologies....

Linux

Error: ERROR 2997: Encountered IOException. Permission denied: user=root, access=WRITE, inode="/user":hdfs:supergroup:drwxr-xr-


ERROR 2997: Encountered IOException. Permission denied: user=root, access=WRITE, inode="/user":hdfs:supergroup:drwxr-xr-


This is the error happening in hadoop environments. The /user/ directory is owned by "hdfs" with 755 permissions. As a result only hdfs can write to that directory. Unlike unix/linux, hdfs is the superuser and not root.

So we need to run the command with sudo.

Examples,

#sudo -u hdfs hadoop fs -mkdir /user/myfile

#sudo -u hdfs hadoop fs -put myfile.txt /user/

If you want to create a home directory for root so you can store files in his directory,

#sudo -u hdfs hadoop fs -mkdir /user/root

#sudo -u hdfs hadoop fs -chown root /user/root

Then we can run the command "hadoop fs -put file /user/root/" as root.

An alternate way is to simply switch the user to hdfs and then we can run the commands without sudo.

 

Leave a Reply