[Hadoop] Demonstration of hadoop command
Make temp folder and files
$ mkdir ~/tmpFolder$ touch ~/tmpFolder/sample_file.txt$ touch ~/tmpFolder/student_info.csv

Starting the Hadoop File System:
$ ./hadoop/sbin/start-all.sh

Open the browser and go to the link
- http://localhost:50070/
- select Utilities menu
- check Browse the file system

Make directory on HDFS
$ hdfs dfs -mkdir /hadoopFolder

Put files on HDFS
$ hdfs dfs -put ~/tmpFolder/sample_file.txt /hadoopFolder/hadoop_file.txt$ hdfs dfs -put ~/tmpFolder/student_info.csv /hadoopFolder/hadoop_info.csv

It is same as
$ hadoop fs -copyFromLocal <path1> <path2>syntax.
Get files on HDFS
$ hdfs dfs -get /hadoopFolder/hadoop_file.txt ~/tmpFolder/get_file.txt$ hdfs dfs -get /hadoopFolder/hadoop_info.csv ~/tmpFolder/get_info.csv

It is same as
$ hadoop fs -copyToLocal <path1> <paht2>syntax.
List all files
$ hdfs dfs -ls /hadoopFolder

It is same as
$ hadoop fs -ls /hadoopFoldersyntax.
Count directories, files
$ hdfs dfs -count /hadoopFolder

Remove all directories and files
$ hdfs dfs -rm -r /hadoopFolder

댓글남기기