Professional Documents
Culture Documents
1/ help
$ hadoop fs –help
Liệt kê các câu lệnh trong HDFS
2/ Usage
$ hadoop fs –usage <command>
Liệt kê các tuỳ chọn của một câu lệnh cụ thể
Vd: Liệt kê các tuỳ chọn của câu lệnh ls (-d, -h, -R)
3/ ls
$ hadoop fs –ls
This command will list all the available files and subdirectories under default directory.
For instance, in our example the default directory for Cloudera VM is /user/cloudera
Liệt kê tất cả các thư mục và đường dẫn có sẵn ở đường dẫn mặc định (trên HDFS)
5/ CopyFromLocal
Copy a file from local filesytem to HDFS location. Copy thư mục từ local qua HDFS.
hadoop fs -copyFromLocal <localsrc> <hdfs destination>
VD:
Tạo 1 file văn bản ở Desktop.
Thêm nội dung để chút nữa đọc nội dung bằng câu lệnh cat
6/ Put
hadoop fs -put <localsrc> <desti>
- The Hadoop fs shell command put is similar to the copyFromLocal, which copies files
or directory from the local filesystem to the destination in the Hadoop filesystem.
Tương tự câu lệnh copyFromLocal
7/ Get
hadoop fs -get <src> <localdest>
The Hadoop fs shell command get copies the file or directory from the Hadoop file
system to the local file system.
Copy thư mục hoặc đường dẫn từ HDFS về local
VD copy file VD từ bên HDFS về Cloudera’s Home (thư mục nằm ở màn hình cloudera
desktop)
8/ copyToLocal
hadoop fs -copyToLocal <hdfs source> <localdst>
copyToLocal command copies the file from HDFS to the local file system.
Tương tự câu lệnh get phía trên
9/ cat
hadoop fs –cat /path_to_file_in_hdfs
The cat command reads the file in HDFS and displays the content of the file on console
or stdout.
Câu lệnh dùng để dọc nội dung thư mục ở HDFS
VD đọc file văn bản VD vừa tạo lúc nãy