博主头像
HT.

ワクワク

上传文件到MinIO报错The difference between the request time and the server's time is too large.

前言

最近写一个上传文件到MinIO的小工具,但是上传文件时报错

minio.error.S3Error: S3 operation failed; code: RequestTimeTooSkewed, message: The difference between the request time and the server's time is too large., resource: /wallpaper, request_id: 182C1C2F334DF937, host_id: dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8

报错内容提示请求端和服务端的时间跨度太大,然后我使用timedatectl 命令在虚拟机上查看发现虚拟机上的时间和我本地的时间不一致

[root@localhost ~]# timedatectl
      Local time: 四 2025-03-13 00:50:42 CST
  Universal time: 三 2025-03-12 16:50:42 UTC
        RTC time: 六 2025-03-22 05:09:13
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a

解决

这里我们只需要时间服务器同步就行

1、安装ntp ntpdate

yum -y install ntp ntpdate

2、与时间服务器同步

ntpdate cn.pool.ntp.org

3、将系统时间写入硬件时间

hwclock --systohc

再次查看系统时间发现已经一致了

[root@localhost ~]# timedatectl
      Local time: 六 2025-03-22 13:17:34 CST
  Universal time: 六 2025-03-22 05:17:34 UTC
        RTC time: 六 2025-03-22 05:17:34
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a
上传文件到MinIO报错The difference between the request time and the server's time is too large.
http://www.perlink.cc/index.php/%E7%AC%94%E8%AE%B0/61.html
本文作者 HT.
发布时间 2025-03-22
许可协议 CC BY-NC-SA 4.0
发表新评论