如何删除由 spark -streaming 应用程序从 eventhub 接收消息生成的进度目录

How to delete the progress directory generated by spark -streaming application recieving messages from eventhub

Eventhubutils 库生成的进程目录正在 hdfs 中创建大量小文件。https://github.com/Azure/spark-eventhubs/blob/master/docs/direct_stream.md。由于这些小文件,namenode的负载很大。有没有什么办法可以在不影响spark应用的情况下删除progress目录。

enter image description here

根据我的经验,如果您当前的任务正在执行,则无法删除生成的文件。

这里我提供两种无代码删除文件的方法供大家参考

第一种方式:

因为HDFS上的文件可以在azure blob storage container上找到,可以直接在Azure portal上删除。如果不想一个一个删除文件,可以使用Azure Storage Explorer工具select所有文件删除。

第二种方式:

可以登录集群机器,使用rm command line:

hadoop fs -rm [-f] [-r |-R] [-skipTrash] URI [URI ...]

configuration file.

中可以找到对应的azure blob storage container路径
wasbs://yourcontainer@youraccount.blob.core.windows.net/testDir/testFile.

希望对你有帮助。