Updated on 2022-11-18 GMT+08:00

Scenario

Typical Scenario Description

Based on typical scenarios, users can quickly learn and master the HDFS development process and know important interface functions.

Scenario

Service operation objects of HDFS are files. File operations in example codes include creating a folder, writing data into a file, appending data to a file, reading data from a file, and deleting a file or folder. HDFS also supports other services including setting file permission. You can learn how to perform other operations on HDFS after learning the example codes in this chapter.

The example codes are described in the following order:

  1. Initializing the HDFS.
  2. Creating directories.
  3. Writing data into a file.
  4. Appending data to a file.
  5. Reading data from a file.
  6. Deleting a file.
  7. Deleting directories.
  8. Multi-thread tasks
  9. Setting storage policies.
  10. Operation on SmallFS.
  11. Colocation.