0
votes

Im a fresher in hadoop and pig.i have installed pig in my local user in ubuntu and hadoop as hduser.Pig working fine in local mode for small datasets.started pig in mapreduce mode and tryng to implement wordcount but getting permission denied error as below. Caused by: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.AccessControlException): Permission denied: user=basi, access=WRITE, inode="/":hduser:supergroup:drwxr-xr-x

started hadoop in psudomode statrted pig in local user:pig -x mapreduce

   grunt> A = LOAD '/Wordcount.txt' AS (line:Chararray);
   grunt> B = FOREACH A GENERATE FLATTEN(TOKENIZE(line)) AS word;
   grunt> grouped = group B by word;
   grunt> wc = FOREACH grouped GENERATE group, COUNT(B);
   grunt> DUMP wc

/Wordcount.txt is file in hdfs

4

4 Answers

1
votes

Its not clear how you loaded /Wordcount.txt into the root folder, but the error is saying you're trying to write into the root directory, which is only possible as the hduser account, not basi, your local user.

One option - switch to the other user.

Otherwise, don't use the root of HDFS as the dumping ground for all files; use your dedicated /user directory

1
votes

It is not Pig but Hadoop related. It happened to me with Spark. Probably you installed your Hadoop manually. You need to create supergroup and add hduser into supergroup.

sudo groupadd supergroup
sudo usermod -aG supergroup hduser

Then try again.

0
votes

proceed as below

chmod 777 /Wordcount.txt

chmod change the permission of text file as rwxrwxrwx for owner group and other respectively

and then provide complete location of text file in the load command similar to below

grunt> A = LOAD '/directory/abc/Wordcount.txt' AS (line:Chararray);

then run the code again...

hopes this will help you out.

0
votes

In Pig, DUMP command would first write its output to /tmp/temp.... and then the client reads from it. My guess is, your cluster does not have /tmp. If that is the case, please try creating the /tmp directory (usually with permission 1777).

(Edited: Reading answers of others, I think the one about /user makes sense. Without it, you won't even be able to submit any jobs.)