ntpdate同步更新时间

 

 Linux服务器运行久时,系统时间就会存在一定的误差,一般情况下可以使用date命令进行时间设置,但在做数据库集群分片等操作时对多台机器的时间差是有要求的,此时就需要使用ntpdate进行时间同步

1、安装ntpdate

1
yum install ntpdate -y

ntpdate简单用法:

1
2
# ntpdate ip
# ntpdate cn.pool.ntp.org 

2、date命令

1
2
date :查看当前时间,结果如下:Tue Mar 4 01:36:45 CST 2014
date -s 09:38:40 :设置当前时间,结果如下:Tue Mar 4 09:38:40 CST 2014

3、ntpdate命令

1
ntpdate -u cn.pool.ntp.org  :网络时间同步命令

 ntp1.aliyun.com 阿里云NTP服务器

ntp2.aliyun.com 阿里云NTP服务器
time1.aliyun.com 阿里云NTP服务器
time2.aliyun.com 阿里云NTP服务器

国外

1
2
3
4
5
6
7
8
9
10
time1.apple.com 苹果NTP服务器
time2.apple.com 苹果NTP服务器
time3.apple.com 苹果NTP服务器
time4.apple.com 苹果NTP服务器
time5.apple.com 苹果NTP服务器
time1.google.com 谷歌NTP服务器
time2.google.com 谷歌NTP服务器
time3.google.com 谷歌NTP服务器
time4.google.com 谷歌NTP服务器
pool.ntp.org 开源免费NTP服务器

5、加入crontab

1
echo "*/20 * * * * /usr/sbin/ntpdate -u ntp1.aliyun.com >/dev/null &" >> /var/spool/cron/root

 

原文链接:https://www.cnblogs.com/luchuangao/p/7795293.html#_label2
 
« 上一篇: NFS服务基础
» 下一篇: 挂载xfs磁盘
posted @ 2017-11-06 21:29  luchuangao  阅读(66275)  评论(3)  编辑  收藏  举报

 
posted @ 2021-10-03 16:12  世间一切的清算  阅读(70)  评论(0编辑  收藏  举报