zoukankan      html  css  js  c++  java
  • ALI OSS RequestTimeTooSkewed

    php版阿里oss sdk,请求时抛RequestTimeTooSkewed错误,说时间差距太大,搜了一下发现是服务器的时间设置问题。

    我们在安装完Centos Linux操作系统之后,点击系统的时间发现与现在所使用的时间不一致,相差有8小时,而在安装系统的时候我们选择的时区是上海,但是CentOS Linux默认的bios时间是utc时间(UTC是协调世界时(Universal Time Coordinated)英文缩写,是由国际无线电咨询委员会规定和推荐,并由国际时间局(BIH)负责保持的以秒为基础的时间标度。UTC相当于本初子午线(即经度0度)上的平均太阳时,过去曾用格林威治平均时(GMT)来表示.北京时间比UTC时间早8小时,以1999年1月1日0000UTC为例,UTC时间是零点,北京时间为1999年1月1日早上8点整。),所以我们在时间上面相隔了8个小时。这个时候bios的时间和系统的时间当然是不一致,一个代表 utc 时间,一个代表cst(+8时区),即上海的时间。

    让我们动手将操作系统的时间进行同步吧!

    在CentOS Linux中终端命令中执行以下命令:

    1、vi /etc/sysconfig/clock   #编辑时间配置文件

         ZONE="Asia/Shanghai"
         UTC=false                          #设置为false,硬件时钟不于utc时间一致
         ARC=false

    2、ln -sf /usr/share/zoneinfo/Asia/Shanghai    /etc/localtime    #linux的时区设置为上海时区

    3、ntpdate 0.cn.pool.ntp.org    #对准时间

    如果没有安装ntp服务器,刚需要先执行以下命令:

    yum install ntp #安装ntp服务器

    4、/sbin/hwclock --systohc   #设置硬件时间和系统时间一致并校准

    好了,我们的CentOS linux系统时间和计算机硬件时间终于都是cst时间了,并且都是上海时区,终于是正常啦。

  • 相关阅读:
    LeetCode 227. Basic Calculator II
    LeetCode 224. Basic Calculator
    LeetCode 103. Binary Tree Zigzag Level Order Traversal
    LeetCode 102. Binary Tree Level Order Traversal
    LeetCode 106. Construct Binary Tree from Inorder and Postorder Traversal
    LeetCode 105. Construct Binary Tree from Preorder and Inorder Traversal
    LeetCode 169. Majority Element
    LeetCode 145. Binary Tree Postorder Traversal
    LeetCode 94. Binary Tree Inorder Traversal
    LeetCode 144. Binary Tree Preorder Traversal
  • 原文地址:https://www.cnblogs.com/lein-wang/p/4624718.html
Copyright © 2011-2022 走看看