如何在 HDFS 中查找访问频率较低的文件
How to find less frequenlty accessed files in HDFS
除了Cloudera Navigator,如何在HDFS中找到访问频率较低的文件。
我假设您正在寻找 the time a file was last accessed(打开、读取等),因为过去越久,文件访问的次数就越少。
你可以在 Linux 中通过 ls -l -someMoreOptions 非常简单地完成此操作,在 HDFS 中需要做更多的工作。
也许您可以监视上述文件的 /hdfs-audit.log
的 cmd=open
。或者您可以实现一个小功能来读出 FileStatus.getAccessTime()
并且如 Cloudera Community 中 Is there anyway to get last access time of HDFS files? or How to get last access time of any files in HDFS? 所述。
换句话说,需要创建一个扫描所有文件的小程序,读取属性
...
status = fs.getFileStatus(new Path(line));
...
long lastAccessTimeLong = status.getAccessTime();
Date lastAccessTimeDate = new Date(lastAccessTimeLong);
...
并订购。这样您就可以找到长时间未访问的文件。
除了Cloudera Navigator,如何在HDFS中找到访问频率较低的文件。
我假设您正在寻找 the time a file was last accessed(打开、读取等),因为过去越久,文件访问的次数就越少。
你可以在 Linux 中通过 ls -l -someMoreOptions 非常简单地完成此操作,在 HDFS 中需要做更多的工作。
也许您可以监视上述文件的 /hdfs-audit.log
的 cmd=open
。或者您可以实现一个小功能来读出 FileStatus.getAccessTime()
并且如 Cloudera Community 中 Is there anyway to get last access time of HDFS files? or How to get last access time of any files in HDFS? 所述。
换句话说,需要创建一个扫描所有文件的小程序,读取属性
...
status = fs.getFileStatus(new Path(line));
...
long lastAccessTimeLong = status.getAccessTime();
Date lastAccessTimeDate = new Date(lastAccessTimeLong);
...
并订购。这样您就可以找到长时间未访问的文件。