Scenarios
For relatively simple file operations, they can be performed directly using the command-line approach. This article guides you on how to access Metadata Acceleration-enabled buckets via Hadoop Shell using the command-line method.
Prerequisites
Log in to any server that has completed environment deployment and HDFS protocol configuration, and go to the command-line interface.
Supported Operations
2. Below are some common file operations.
Traverse Directory (list)
hadoop fs -ls cosn://examplebucket-1250000000/
Create Directory (mkdir)
hadoop fs -mkdir -p cosn://examplebucket-1250000000/test_01/xxx
Uploading Files
hadoop fs -put ./len1m.txt cosn://examplebucket-1250000000/test_01/xxx/len1m_1.txt
Downloading a File
hadoop fs -get cosn://examplebucket-1250000000/test_01/xxx/len1m_1.txt ./len1m_1.txt
Deletes files
hadoop fs -rm cosn://examplebucket-1250000000/test_01/xxx/len1m_1.txt
Deleting a Directory
hadoop fs -rm -r cosn://examplebucket-1250000000/test_01/xxx
Directory Statistics (du)
hadoop fs -du cosn://examplebucket-1250000000/test_01
File Checksum
hadoop fs -checksum cosn://examplebucket-1250000000/test_01/xxx/len1m_1.txt