NTP 时区+时间同步

NTP 时区+时间同步选一台机器为server其它机器为client从server端同步时间
摘要由CSDN通过智能技术生成

一台主机作为server(时间服务器),其它机架作为client(客户机)从server同步时间

  • 准备

安装ntp和ntpdate
yum install -y ntpdate
yum install -y ntp

server
  1. 选一天机器作为server
  • 修改 /etc/ntp.conf,添加如下
# 中国这边最活跃的时间服务器 : http://www.pool.ntp.org/zone/cn
server 0.cn.pool.ntp.org
server 0.asia.pool.ntp.org
server 3.asia.pool.ntp.org

# allow update time by the upper server 
# 允许上层时间服务器主动修改本机时间 
restrict 0.cn.pool.ntp.org nomodify notrap noquery 
restrict 0.asia.pool.ntp.org nomodify notrap noquery 
restrict 3.asia.pool.ntp.org nomodify notrap noquery

# Undisciplined Local Clock. This is a fake driver intended for backup 
# and when no outside source of synchronized time is available. 
# 外部时间服务器不可用时,以本地时间作为时间服务
server 127.127.1.0 # local clock 
fudge 127.127.1.0 stratum 10
  • 启动服务
service ntpd start
  • 查看
ntpdstat 

Client
  • 定时从server端同步时间
  • 添加如下定时任务,保存
[root@hadoop003 .ssh]# crontab -e

*/5 * * * * /usr/sbin/ntpdate 192.168.52.131

注意: NTP服务只需在server端开启,Client端不需要开启

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值