1、安装ntp服务

root@localhost ~]# yum -y install ntp
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.nju.edu.cn
 * centos-sclo-rh: mirrors.nju.edu.cn
 * centos-sclo-sclo: mirrors.huaweicloud.com
 * epel: mirrors.huaweicloud.com
 * extras: mirrors.nju.edu.cn
 * nux-dextop: mirror.li.nux.ro
 * updates: mirrors.nju.edu.cn
软件包 ntp-4.2.6p5-29.el7.centos.2.x86_64 已安装并且是最新版本

2、启动ntpd

[root@localhost elasticsearch]# systemctl start ntpd
[root@localhost elasticsearch]# systemctl enable ntpd

#列显示了 NTP 服务器的 IP 地址或主机名
[root@localhost elasticsearch]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 119.28.206.193  .STEP.          16 u  614   64    0    0.000    0.000   0.000
+ntp.ams1.nl.lea 130.133.1.10     2 u   23   64    1  211.185   -1.552   6.721
+ntp1.flashdance 194.58.202.20    2 u   57   64    1  257.396    0.792   0.827
*electrode.felix 131.188.3.221    2 u   55   64    1  184.682    6.590   0.424

 3、修改ntp配置文件

vim /etc/ntp.conf
#同步阿里云时间
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server ntp.aliyun.com iburst


#重启服务
systemctl restart ntpd

 4、203.107.6.88    就是阿里云的ntp服务器的ip地址了

[root@localhost elasticsearch]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*203.107.6.88    100.107.25.114   2 u   20   64    1   29.587    6.472   0.839
 

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐