2)、时钟同步

查看时区

timedatectl status|grep 'Time zone'

#设置时区为上海
timedatectl set-timezone Asia/Shanghai
#设置硬件时钟调整为与本地时钟一致
timedatectl set-local-rtc 1

使用ntpdate同步时间

#安装ntpdate
yum -y install ntpdate
#同步时间
ntpdate -u  pool.ntp.org
#同步完成后,date命令查看时间是否正确
date

more /etc/redhat-release
ps -ef|grep ntp
ll /etc/|grep ntp
systemctl status ntpd


通过ansible集群安装ntp

ansible all -a "yum install -y ntp"
#批量设置 主机 时区为亚洲上海
ansible all -a "timedatectl set-timezone Asia/Shanghai"


172作为主节点

vim /etc/ntp.conf
#添加本地节点
restrict 10.9.70.172 monodify notrap nopeer noquery


166、168服务器同步主节点172的时间

#本地节点
restrict 10.9.70.166 nomodify notrap nopeer noquery
#主节点server
server 10.9.70.172 perfer iburst

#开启服务
service ntpd start
#设置为默认启动,关掉使用off
chkconfig ntpd on
#查看状态
service ntpd status
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值