Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created on 10-29-2015 01:51 PM - edited 09-16-2022 02:46 AM
Hi Friends, I am trying to understand the PIG scripting.
I have created directory called pig_demo and am not able to find when i do hadoop fs -ls /
Appericiate your timely response on this.
details are given bleow
1) [cloudera@quickstart ~]$ pwd
/home/cloudera
[cloudera@quickstart ~]$ hadoop fs -ls /
Found 5 items
drwxr-xr-x - hbase supergroup 0 2015-10-29 13:01 /hbase
drwxr-xr-x - solr solr 0 2015-06-09 08:55 /solr
drwxrwxrwx - hdfs supergroup 0 2015-10-09 06:24 /tmp
drwxr-xr-x - hdfs supergroup 0 2015-06-09 08:56 /user
drwxr-xr-x - hdfs supergroup 0 2015-06-09 08:54 /var
2) [cloudera@quickstart ~]$ hadoop fs -mkdir pig_demo
mkdir: `pig_demo': File exists
[cloudera@quickstart ~]$ hadoop fs -ls /
Found 5 items
drwxr-xr-x - hbase supergroup 0 2015-10-29 13:01 /hbase
drwxr-xr-x - solr solr 0 2015-06-09 08:55 /solr
drwxrwxrwx - hdfs supergroup 0 2015-10-09 06:24 /tmp
drwxr-xr-x - hdfs supergroup 0 2015-06-09 08:56 /user
drwxr-xr-x - hdfs supergroup 0 2015-06-09 08:54 /var
Created 10-29-2015 02:41 PM
Also note that when you just run 'ls' or 'pwd', that's referring to your local / native filesystem. What directory you are currently in in your shell has no effect on what directory it shows you when you say 'hdfs dfs -ls'. Now, there's a /usr directory on the local / native filesystem, but that's a complete separate idea from the /user directory in HDFS.
Created on 10-29-2015 01:58 PM - edited 10-29-2015 02:02 PM
Have you cheked in /user directory?
Created on 10-29-2015 02:01 PM - edited 10-29-2015 02:02 PM
Check in /user/cloudera. Unless you're the 'hdfs' user, HDFS treats
/user/[username] as your home directory. When your paths don't start with
/, they go in there. If they DO start with /, it doesn't resolve it
relative to your home directory. If you just type 'hadoop fs -ls', it'll
look in your home directory and you should see it.
Created 10-29-2015 02:13 PM
I am not able to find under usr
[cloudera@quickstart usr]$ ls
bin games jars lib libexec sbin src
etc include java lib64 local share tmp
[cloudera@quickstart usr]$
[cloudera@quickstart /]$ hadoop fs -ls /
Found 5 items
drwxr-xr-x - hbase supergroup 0 2015-10-29 13:01 /hbase
drwxr-xr-x - solr solr 0 2015-06-09 08:55 /solr
drwxrwxrwx - hdfs supergroup 0 2015-10-09 06:24 /tmp
drwxr-xr-x - hdfs supergroup 0 2015-06-09 08:56 /user
drwxr-xr-x - hdfs supergroup 0 2015-06-09 08:54 /var
Created 10-29-2015 02:25 PM
I think what the earlier responders were suggesting is that you type this at the Linux command prompt:
hdfs dfs -ls /user/cloudera
You should see your new directory, pig-demo, listed as a subdirectory of /user/cloudera.
Can you try this?
(Note: you can use 'hadoop fs -ls /user/cloudera' too, but 'hadoop fs' is being deprecated so best to switch to using 'hdfs dfs ...')
Created 10-29-2015 02:41 PM
Also note that when you just run 'ls' or 'pwd', that's referring to your local / native filesystem. What directory you are currently in in your shell has no effect on what directory it shows you when you say 'hdfs dfs -ls'. Now, there's a /usr directory on the local / native filesystem, but that's a complete separate idea from the /user directory in HDFS.
Created 10-29-2015 03:50 PM
Sean , Thank you very much for providing quick resolution