实战案例——时间同步

本文介绍了如何在CentOS系统中进行时间同步。首先,调整系统时区以确保准确性。接着,安装chrony软件包,它作为内部服务端和互联网客户端的时间同步工具。为了高可用性,通常设置两台服务器,一主一从。最后,提供了针对CentOS 7和6的客户端配置指南。
摘要由CSDN通过智能技术生成

时间同步

  • 先改时区,因为安装系统的时候都是最小化安装,所以之后可能会需要改时区哦~

  • 本地服务端的配置~ 它既是一个服务端(相对于企业内部)又是一个客户端(相对于互联网)

修改时区

[root@centos8 ~]#date
Thu Feb 13 03:06:14 EST 2020
[root@centos8 ~]#ll /etc/localtime 
lrwxrwxrwx. 1 root root 38 Jan  2 16:21 /etc/localtime -> ../usr/share/zoneinfo/America/New_York
[root@centos8 ~]#rm -f /etc/localtime 
[root@centos8 ~]#ln -s ../usr/share/zoneinfo/Asia/Shanghai /etc/localtime
[root@centos8 ~]#ll /etc/localtime 
lrwxrwxrwx 1 root root 35 Feb 13 16:07 /etc/localtime -> ../usr/share/zoneinfo/Asia/Shanghai
[root@centos8 ~]#date
Thu Feb 13 16:08:12 CST 2020
  • 然后就是安装chrony包来提供时间同步,一般都是用两台服务器来做这个服务端(一个主一个从),防止单点失败~
[root@centos8 ~]#yum install chrony -y
[root@centos8 ~]#vim /etc/chrony.conf 

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#pool 2.centos.pool.ntp.org iburst   #此行注释掉
server ntp.aliyun.com  iburst    #增加以下两行
server ntp1.aliyun.com iburst



# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift

# Allow the system clock to be stepped in the first three updates
# if its offset is la
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值