zabbix时间不同步

Linux下如何实现与Internet时间同步
一、安装ntp
[root@server-2 ~]# yum install -y ntpdate
二、同步时间
// 方式一、使用域名连接,要经过DNS解析,速度慢。
[root@server-2 ~]# ntpdate pool.ntp.org

// 方式二、使用IP连接,超级快。 [root@server-2 ~]# ntpdate 120.24.81.91

http://www.pool.ntp.org是NTP的官方网站,在这上面我们可以找到离我们国家的NTP Server cn.pool.ntp.org.它有3个服务器地址:
服务器一: 1.cn.pool.ntp.org
服务器二: 2.asia.pool.ntp.org
服务器三: 3.asia.pool.ntp.org
(直接用域名有时有问题,可以先Ping出他们的IP,然后用IP地址同步)

// 出现以下信息说明成功

Feb 21:23:06 ntpdate[62910]: step time server 182.92.12.11 offset -40.589470 sec
三、将系统时间写入到系统硬件当中,避免重启服务器时间覆盖

// 显示hardwareclock系统硬件时间

[root@server-2 ~]# hwclock

// 将系统时间写入到系统硬件当中

[root@server-2 ~]# hwclock -w
四、设定计划任务同步网络时间
 
设定crontab计划任务:
 
crontab -e
    10 5 * * * /usr/sbin/ntpdate  120.24.81.91

猜你喜欢

转载自www.cnblogs.com/byfboke/p/9075687.html