已解决:The difference between the request time and the server‘s time is too large

背景

通过Freemarker生成Html文件并上传到minio时产生如下报错:

报错原因

因为我的minio是部署在我的linux虚拟机上的,报错提示:The difference between the request time and the server's time is too large,意思是请求端和服务端的时间跨度太大。

解决方案

此时我们可以去查看一下虚拟机的系统时间和硬件时间,不知道这两个时间的区别的小伙伴可以去看一下这篇文章:linux系统时间和硬件时钟问题(date和hwclock)

分别使用命令 date 和 hwclock 查看系统时间和硬件时间:

[root@localhost ~]# date
2023年 10月 23日 星期一 23:04:14 CST
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# hwclock
2024年05月28日 星期二 13时48分06秒  -0.838778 秒

发现时间跨度太大,正是报错问题所在。

可以通过ntpdate同步校时:

1.  安装ntpda(我这里显示已安装)

[root@localhost ~]# yum -y install ntp ntpdate
已加载插件:fastestmirror
Determining fastest mirrors
 * base: mirror.nju.edu.cn
 * extras: mirror.nju.edu.cn
 * updates: mirror.nju.edu.cn
base                                                                                                                            | 3.6 kB  00:00:00     
docker-ce-stable                                                                                                                | 3.5 kB  00:00:00     
extras                                                                                                                          | 2.9 kB  00:00:00     
updates                                                                                                                         | 2.9 kB  00:00:00     
软件包 ntp-4.2.6p5-29.el7.centos.2.aarch64 已安装并且是最新版本
软件包 ntpdate-4.2.6p5-29.el7.centos.2.aarch64 已安装并且是最新版本
无须任何处理
[root@localhost ~]# 

2.  与时间服务器同步时间

[root@localhost ~]# ntpdate cn.pool.ntp.org
28 May 14:03:57 ntpdate[8502]: step time server 139.199.215.251 offset 53024.762798 sec

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

[root@localhost ~]# hwclock --systohc
[root@localhost ~]# 

4. 查看系统时间与硬件时间是否校对成功

[root@localhost ~]# date
2024年 05月 28日 星期二 14:06:05 CST
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# hwclock
2024年05月28日 星期二 14时06分10秒  -0.349845 秒

报错解决

校对成功,再次运行程序,通过,报错解决。

  

文章参考:https://blog.csdn.net/m0_74221471/article/details/136782763icon-default.png?t=N7T8https://blog.csdn.net/m0_74221471/article/details/136782763

  • 10
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值