Shell operation of HDFS (notes)
* 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