【问题标题】:Unable write current date to the HDFS directory无法将当前日期写入 HDFS 目录
【发布时间】:2021-08-03 08:45:59
【问题描述】:

我想将当前日期写入 HDFS 中的文件,以便下次运行时读取它。 例如:通过以下命令,我想将 2021-08-03 08:43:37 写入 HDFS 目录 /user/maria_dev/satheesh/temp。我在下面尝试过,但没有奏效。请问有什么建议吗?

echo `date '+%Y-%m-%d %H:%M:%S' | hadoop fs -put - /user/maria_dev/satheesh/temp

【问题讨论】:

  • 您收到的错误是什么?
  • 没有错误,将 - 添加到 hdfs 位置。
  • 不建议在HDFS中存储这么小的文件

标签: linux hadoop hdfs put


【解决方案1】:

基本上它是使用 put 命令和 - 作为文件名将日期写入 HDFS 目录。当我做猫时,我得到了日期。

echo `date '+%Y-%m-%d %H:%M:%S' | hadoop fs -put - /user/maria_dev/satheesh/temp'

[maria_dev@sandbox-hdp ~]$ hadoop fs -cat /user/maria_dev/satheesh/temp/*

输出: 2021-08-03 08:39:58

【讨论】:

    猜你喜欢
    • 2019-06-15
    • 1970-01-01
    • 1970-01-01
    • 2019-08-21
    • 1970-01-01
    • 1970-01-01
    • 2013-11-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多