dti3914 2018-10-11 09:21
浏览 67

使用AWS-SDK Go从COS即时读取文件

I have a file in S3 that is being continuously modified. I will have to read it and display it live on the stdout.

That is, I read the first line, and if the file is modified and a second line is added, I will have to reflect those changes in my stdout. I want all of this to happen in a single command and without running the command multiple times to read the updated file.

I need a golang functionality like bash command "tail -f <FILENAME>" that reads a S3 file from COS.

  • 写回答

1条回答 默认 最新

  • douma5954 2018-10-11 15:35
    关注

    The design you are proposing will not work correctly

    This is because

    Amazon S3 offers eventual consistency for overwrite PUTS and DELETES in all regions.

    (see Introduction to S3)

    What this means in practice is that overwriting or updating an S3 object does not quickly allow reads of the same object - which is what you need to "tail" a file

    I suggest you rethink the way you are monitoring the file

    You haven't said why you wish to tail the file but (for example) if you are simply looking for activity then Cloudwatch can be used to get various rate metrics from S3

    If your originating file is on an EC2 instance then Cloudwatch Logs might be a good fit

    评论

报告相同问题?

悬赏问题

  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题