美文网首页
CentOS7时间设置与多虚拟机时间同步设置

CentOS7时间设置与多虚拟机时间同步设置

作者: funOfFan | 来源:发表于2021-04-17 09:25 被阅读0次

环境说明

  • 三台虚拟机 agent、server、state
  • centos7版本为 CentOS-7-x86_64-Minimal-1810

agent端设置时区为上海时区

timedatectl set-ntp no
timedatectl list-timezones
timedatectl set-timezone Asia/Shanghai
timedatectl
#退出当前登录会话 
ctrl + D 
# 重新登录agent虚拟机,并查看时间是否已经修改成功
timedatectl
date

server、state端设置与agent端时间同步

yum -y install ntp ntpdate

vim /etc/ntp.conf
#编辑内容如下
restrict 127.0.0.1
restrict -6 ::1
restrict default ignore
server agent-ip
fudge agent-ip stratum 8

vi /etc/sysconfig/ntpd
OPTIONS="-g -l /var/log/ntpstats/ntpd.log"

#配置开机自启动
chkconfig ntpd on

#启动ntpd服务
service ntpd start

相关文章

网友评论

      本文标题:CentOS7时间设置与多虚拟机时间同步设置

      本文链接:https://www.haomeiwen.com/subject/prrulltx.html