Warm tip: This article is reproduced from stackoverflow.com, please click
hadoop hdfs

hadoop can't expunge: "-expunge: Illegal option -immediate"?

发布于 2020-04-08 23:37:29

I am trying to clear the .Trash folder for an HDFS user with the -immediate option

[airflow@airflowetl root]$ hadoop version
Hadoop 3.1.1.3.1.0.0-78
Source code repository git@github.com:hortonworks/hadoop.git -r e4f82af51faec922b4804d0232a637422ec29e64
Compiled by jenkins on 2018-12-06T12:26Z
Compiled with protoc 2.5.0
From source with checksum eab9fa2a6aa38c6362c66d8df75774
This command was run using /usr/hdp/3.1.0.0-78/hadoop/hadoop-common-3.1.1.3.1.0.0-78.jar

[airflow@airflowetl root]$ hadoop fs -expunge -immediate
-expunge: Illegal option -immediate
...
...
...

without the -immediate option, I still see errors

[airflow@airflowetl root]$ hadoop fs -expunge
20/01/31 11:35:08 WARN hdfs.DFSClient: Cannot get all encrypted trash roots
org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.AccessControlException): Access denied for user airflow. Superuser privilege is required

Does anyone know what could be going on here? Any other debugging advice?

Questioner
lampShadesDrifter
Viewed
80
cricket_007 2020-02-02 22:53

You can't run the command as an non Hadoop admin user account.

You'll need to switch to the hdfs user via sudo su - hdfs

You could also try hdfs dfs -rm -R -skipTrash .Trash/*