Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Shell operation of HDFS (notes)

Shulou Source: shulou.com Published: 2022-06-03 05:07:05 10月04日 Update

* basic operation (single cluster): *

1. Create folder command

[hadoop@master] $hadoop fs-mkdir-p / 20191021

2. Upload file command

[hadoop@master ~] $hadoop fs-put test.txt / 20191021

3. View file command

[hadoop@master ~] $hadoop fs-cat / 20191021/test.txt

4. File copy command (copy to local)

[hadoop@master ~] $hadoop fs-get / 20191021/test.txt

5. Check the file directory under the directory

[hadoop@master ~] $hadoop fs-ls / 20191021

6. Delete file command

[hadoop@master ~] $hadoop fs-rm / 20191021/test.txt

7. Delete folder command

[hadoop@master ~] $hadoop fs-rmr / 20191021

Common operation commands for administrators:

1. View the running Job

[hadoop@master ~] $hadoop job-list

2. Close the running Job

[hadoop@master ~] $hadoop job-kill (name of the running job)

3. Check the status of the HDFS block to see if it is damaged

[hadoop@master ~] $hadoop fsck

4. Check the status of HDFS blocks and delete damaged blocks

[hadoop@master ~] $hadoop fsck /-delete

5. Check the status of HDFS blocks, including DataNode information

[hadoop@master ~] $hadoop dfsadmin-report

6. Hadoop enters safe mode

[hadoop@master ~] $hadoop dfsadmin-safemode enter

7. Hadoop leaves safe mode

[hadoop@master ~] $hadoop dfsadmin-safemode leave

8. Balance the files in the cluster

[hadoop@master hadoop] $sbin/start-balancer.sh

Tags: Files commands in progress status check run security folders patterns directories clusters information names basic operations commonly used administrators jobs management notes Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Docker NVidia Apple Shulou Information