Minio 所需要的时间同步问题

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: /, request_id: , host_id: 796ffd30-0d6b-461a-9ff3-d1f5312c7e0c

开启esxi主机的ntpd服务后,设置了ntp服务器为 0.pool.ntp.org和1.pool.ntp.org,2.pool.ntp.org 的IP地址,肉眼上看本地时间和服务器时间时相同的,但依然报错

Traceback (most recent call last):
  File "upload_email_file_to_minio_kafka.py", line 174, in 
    main()
  File "upload_email_file_to_minio_kafka.py", line 111, in main
    bucket_list = mc.list_buckets()
  File "C:\Users\milly\AppData\Local\Programs\Python\Python38\lib\site-packages\minio\api.py", line 647, in list_buckets
    response = self._execute("GET")
  File "C:\Users\milly\AppData\Local\Programs\Python\Python38\lib\site-packages\minio\api.py", line 406, in _execute
    return self._url_open(
  File "C:\Users\milly\AppData\Local\Programs\Python\Python38\lib\site-packages\minio\api.py", line 389, in _url_open
    raise response_error
minio.error.S3Error: S3 operation failed; code: RequestTimeTooSkewed, message: The difference between the request time and the server's time is too large., resource: /, request_id: , host_id: 796ffd30-0d6b-461a-9ff3-d1f5312c7e0c

CentOS 查看系统时间:

timedatectl

设置时区

timedatectl set-timezone Asia/Hong_Kong

查看时区列表

timedatectl list-timezones

centos 8 不再支持ntp,因此,yum install ntp 无法安装,但是默认使用 chrony
四个 minio server 重启了该服务后,时间同步成功,可以在主机访问 minio 服务了

systemctl restart chronyd

时区在时间同步问题上,没有影响

局域网:

局域网内找不到互联网的ntp服务器
思路:将windows主机作为ntp服务器,用EXSI同步w32time时间服务,虚拟机设置同步客户机时间与主机时间,同步ESXI的系统时间,

Windows 开启 w32time服务

    a. HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\W32Time\TimeProviders\NtpServer\Enabled项目设置为1
    b. HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\W32Time\Config\AnnounceFlags设置为5,表示以本地时间为时间源
    c. 打开services.msc,启动WindowsTime服务,设置自动启动
    d. net stop w32time && net start w32time ,重启w32time服务
    e. 关闭防火墙(开放UDP端口123)

ESXI设置NTP服务(vmware tools每隔1分钟对虚拟机时间进行一次检查)

  • 主机管理->系统->时间和日期->编辑NTP设置,
  • 主机管理->服务->ntpd重启

虚拟机(CentOS 8):

如果没有自动同步,需要root权限执行以下步骤

  • timedatectl set-ntp no
  • timedatectl set-time 2020-02-02 #设置一个较早的日期-
  • date #查看当前日期
  • systemctl restart chronyd #重启
  • date #查看当前日期
  • 一般来说已经同步成功了

你可能感兴趣的:(Minio 所需要的时间同步问题)