首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >Linux配置时间同步

Linux配置时间同步

作者头像
cywhat
发布2022-11-22 21:37:20
发布2022-11-22 21:37:20
7.3K0
举报
文章被收录于专栏:cywhatcywhat

前景

排查售后问题发现一个奇葩BUG是因为Linux服务器时间不同步导致

1.安装ntpdate
代码语言:shell
复制
yum install -y ntpdate
2.同步时间
代码语言:shell
复制
ntpdate 0.asia.pool.ntp.org   #0.asia.pool.ntp.org 为ntp时间服务器name
3.同步系统时间到硬件
代码语言:shell
复制
hwclock --systohc
4.设置定时任务
代码语言:shell
复制
crontab -e 


#输入以下定时任务
0 */2 * * * /usr/sbin/ntpdate  0.asia.pool.ntp.org    #每2小时执行一次
5.备用的时间服务器
代码语言:shell
复制
cn.pool.ntp.org

ntp.sjtu.edu.cn

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
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022-01-05,如有侵权请联系 cloudcommunity@tencent.com 删除
目录
  • 前景
    • 1.安装ntpdate
    • 2.同步时间
    • 3.同步系统时间到硬件
    • 4.设置定时任务
    • 5.备用的时间服务器
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档