chrony时间同步服务配置
1.安装服务(一般服务器都默认安装了的)
[root@disasterproofapp ~]# yum install -y chrony
2.修改时间同步配置文件
[root@disasterproofapp ~]# vi /etc/chrony.conf
#server 0.centos.pool.ntp.org iburst --注释这行
#server 1.centos.pool.ntp.org iburst --注释这行
#server 2.centos.pool.ntp.org iburst --注释这行
server ntp.ntsc.ac.cn iburst --添加这行,表示与本机同步时间(视情况自行更改)
3.启动服务
[root@disasterproofapp ~]# systemctl restart chronyd
4.开机自启
[root@disasterproofapp ~]# systemctl enable chronyd
5.手动测试同步
[root@disasterproofapp ~]# chronyc sources -v
210 Number of sources = 1
.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| / '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
^* 114.118.7.163 2 6 27 1 -31ms[ -857ms] +/- 55ms
这里有ip说明同步成功
6.查看时间是否正常
[root@disasterproofapp ~]# date
2022年 04月 13日 星期三 10:42:17 CST