hdfs 文件时间戳
Hdfs file timestamp
我想获取 hdfs 上文件的 last_modification 时间。我检查了 HDFS shell 指南,但没有得到任何可用的相关命令。
Hadoop 版本为 2.4.0。谁能建议我如何获得 hdfs 文件的 last_modification 时间?
提前致谢
您可以从 hadoop ls 命令检索时间戳并使用 awk.There 是 file/directory 时间戳的模式来解析它。
对于文件,它是
permissions number_of_replicas userid groupid filesize modification_date modification_time filename
目录是
permissions userid groupid modification_date modification_time dirname
文件的第 6 和第 7 个字段为您提供修改日期和时间。您可以使用以下示例来检索这些信息。
hadoop fs -ls /textfile | awk '{timestamp= " " ;print timestamp}'
请参阅 ls 命令的文档。
http://hadoop.apache.org/docs/r2.7.0/hadoop-project-dist/hadoop-common/FileSystemShell.html
希望这会有所帮助。
我想获取 hdfs 上文件的 last_modification 时间。我检查了 HDFS shell 指南,但没有得到任何可用的相关命令。
Hadoop 版本为 2.4.0。谁能建议我如何获得 hdfs 文件的 last_modification 时间?
提前致谢
您可以从 hadoop ls 命令检索时间戳并使用 awk.There 是 file/directory 时间戳的模式来解析它。 对于文件,它是
permissions number_of_replicas userid groupid filesize modification_date modification_time filename
目录是
permissions userid groupid modification_date modification_time dirname
文件的第 6 和第 7 个字段为您提供修改日期和时间。您可以使用以下示例来检索这些信息。
hadoop fs -ls /textfile | awk '{timestamp= " " ;print timestamp}'
请参阅 ls 命令的文档。
http://hadoop.apache.org/docs/r2.7.0/hadoop-project-dist/hadoop-common/FileSystemShell.html 希望这会有所帮助。