HDFS Exercises - Basic
HDFS Exercises - Basic
HDFS Exercises - Basic
Command / Syntax
$ bin/hadoop fs -mkdir [dir-name]
$ bin/hadoop fs -rmdir [dir-name]
Recursive Delete (for non-empty directories):
$ bin/hadoop fs -rmr [dir-name]
$ bin/hadoop fs -copyFromLocal
$ bin/hadoop fs -moveFromLocal
[local-source] [hdfs-destination]
[local-source] [hdfs-destination]
[source]
[source]
[destination]
[destination]
$ bin/hadoop fs -copyToLocal
$ bin/hadoop fs -moveToLocal
[source] [local-destination]
[source] [local-destination]
[path]
[path]
Examples
$
$
$
$
$
$
$
bin/hadoop
bin/hadoop
bin/hadoop
bin/hadoop
bin/hadoop
bin/hadoop
bin/hadoop
fs
fs
fs
fs
fs
fs
fs
$
S
$
$
$
$
bin/hadoop fs
ls -ltr $HOME
bin/hadoop fs
bin/hadoop fs
ls -ltr $HOME
bin/hadoop fs
-mkdir /hduser00
-mkdir /testing00
-ls /
-ls /hduser00
-ls /testing00
-rmdir /testing00
-ls /
-copyFromLocal
$HOME/testing123.txt /hduser00/testing123.txt
-ls /hduser00
-moveFromLocal $HOME/testing123.txt /hduser00/testingABC.txt
-ls /hduser00
$ bin/hadoop fs -ls /
$ bin/hadoop fs -ls /hduser00
$ bin/hadoop fs -du /
$ bin/hadoop fs -du /hduser00
$
$
$
$
bin/hadoop
bin/hadoop
bin/hadoop
bin/hadoop
fs
fs
fs
fs
/hduser00/testingXYZ.txt $HOME/testingXYZ.txt
http://<HOST>:<PORT>/webhdfs/v1/<PATH>?user.name=hduser&]op=
where
op=MKDIRS[&permission=<OCTAL>]
EXAMPLE
curl -i -X PUT -b cookie.jar "http://host:port/webhdfs/v1/tmp/csv.txt?op=RENAME&destination=/tmp
REF: https://hadoop.apache.org/docs/r1.0.4/webhdfs.html
http://ubuntu.dhcp.blrl.sap.corp:50070/webhdfs/v1/testing00?op=LISTSTATUS