Board logo

标题: [求助] 服务器里面的时间和后台的时间对不上 [打印本页]

作者: yangtao    时间: 2017-3-21 12:18     标题: 服务器里面的时间和后台的时间对不上

1.png
2017-3-21 12:15
2.png
2017-3-21 12:15
服务里面的时间和后台的时间对不上,是什么原因,导致网站日志里面的时间慢了12个小时

图片附件: 1.png (2017-3-21 12:15, 2.2 KB) / 下载次数 5562
http://www.wdlinux.cn/bbs/attachment.php?aid=7151&k=946a1cb6a7c7da663ef736d3a08b0bc6&t=1711615065&sid=o1ol01



图片附件: 2.png (2017-3-21 12:15, 4.82 KB) / 下载次数 5521
http://www.wdlinux.cn/bbs/attachment.php?aid=7152&k=b54dff6cbddbb36f5d88535b91741472&t=1711615065&sid=o1ol01


作者: QQ613049616    时间: 2017-3-21 22:26

同步系统时间和硬件时间,可以使用hwclock命令。

//以系统时间为基准,修改硬件时间

[root@localhost ~]# hwclock --systohc<== sys(系统时间)to(写到)hc(Hard Clock)
[root@localhost ~]# hwclock -w

//以硬件时间为基准,修改系统时间

[root@localhost ~]# hwclock --hctosys
[root@localhost ~]# hwclock -s





一,用ntpdate从时间服务器更新时间

如果你的linux系统根本没有ntpdate这个命令

yum install ntp  
安装完了之后,你不要做什么配置,也不需要,直接测试一下

[root@localhost ~]# ntpdate time.nist.gov  
22 Oct 21:11:43 ntpdate[5014]: adjust time server 207.200.81.113 offset -0.018788 sec  
如果出去上面的内容说明,同步成功了。然后在crontab里面加上以下内容。

*/10 * * * * ntpdate time.nist.gov   #域名或IP  
每隔十分钟同步一次。推荐几个时间服务器。

time.nist.gov
time.nuri.net
0.asia.pool.ntp.org
1.asia.pool.ntp.org
2.asia.pool.ntp.org
3.asia.pool.ntp.org




欢迎光临 WDlinux官方论坛 (http://www.wdlinux.cn/bbs/) Powered by Discuz! 7.2