Tag Archives: rm: Cannot delete /wxcm/ Name node is in safe mode.

[Solved] Delete hdfs Content Error: rm: Cannot delete /wxcm/ Name node is in safe mode.

Problem: an error is reported when deleting content on HDFS (HDFS DFS – RM – F – R – skiptrash/wxcm): RM: cannot delete/wxcm/name node is in safe mode

Reason: This is because when the distributed file system starts, there will be a security mode at the beginning. When the distributed file system is in the security mode, the contents of the file system cannot be modified or deleted until the security mode ends. The security mode is mainly used to check the validity of data blocks on each datanode when the system is started, and copy or delete some data blocks as necessary according to the policy. Safe mode can also be entered by command during operation. In practice, when the system starts to modify and delete files, there will also be an error prompt that the security mode does not allow modification. You only need to wait for a while.

 

Solution:

(1) Just wait a while;

(2) You can manually leave safe mode with the following command: HDFS dfsadmin – safemode leave

Users can operate the security mode through HDFS dfsadmin – safemode value. The parameter value is described as follows:
HDFS dfsadmin – safemode enter – enter the security mode
HDFS dfsadmin – safemode   Leave – force namenode to leave safe mode
HDFS dfsadmin – safemode   Get – Returns whether the security mode is enabled or not
HDFS dfsadmin – safemode   Wait – wait until the end of safe mode.

However, even if HDFS dfsadmin – safemode leave is executed this time, it cannot exit safe mode.

Run DF – LH and find that the disks of the three nodes are almost full, so clean up unnecessary files to free up disk space. Run HDFS dfsadmin – safemode leave again

Successfully exited.

Then you can successfully delete HDFS: HDFS DFS – RM – F – R – skiptrash/wxcm.

However, after deleting the directory/wxcm on HDFS and emptying the garbage can (HDFS DFS – expunge), check the VMware machines folder, which is the folder where the virtual machine is stored. It is found that the occupied space is still not reduced.

The original VMware virtual machine disk will only become larger and larger, and will not automatically decrease with the deletion of files. You need to compress the disk manually. Specifically, right-click a virtual machine, select “Settings”, select the hard disk, find “compression” on the right, click the compression button, or click “defragmentation”. However, the effect of this method is average. After the physical disk file of VMware’s virtual machine increases, it cannot be reduced. However, after opening the virtual machine, the used disk space displayed in it does decrease.