chrony服务器

目录

1.chrony简介

2.chrony安装配置

[2.1 chrony安装及配置](#2.1 chrony安装及配置)

非常重要:在配置之前,检查防火墙和selinux是否关闭

3.将chrony配置为其他主机的时间服务器

[3.1 修改chrony配置文件](#3.1 修改chrony配置文件)

4.chronyc命令

1.chrony****简介

chrony 是开源的遵循网络时间协议( ntp )的软件,让计算机系统时间与时间服务器时间一致, chrony
也可以作为时间服务器为其他主机提供服务。
ntp (网络时间协议):是 udp 的 123 端口。 chrony 和 ntp 在一个计算机中只能存在一个。

2.chrony****安装配置

2.1 chrony****安装及配置

非常重要:在配置之前,检查防火墙和selinux是否关闭

复制代码
yum install -y chrony
vim /etc/chrony.conf
[root@localhost ~]# cat /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server ntp.aliyun.com iburst (编写的网络时间服务器)
[root@localhost ~]# systemctl enable chronyd
[root@localhost ~]# systemctl enable chronyd
[root@localhost ~]# timedatectl status
Local time: Thu 2023-07-27 10:03:39 CST
Universal time: Thu 2023-07-27 02:03:39 UTC
RTC time: Thu 2023-07-27 02:03:39
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: yes (两个为yes即可)
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a

3.chrony****配置为其他主机的时间服务器

3.1修改chrony****配置文件

复制代码
在提供chrony时间服务器主机的chrony配置文件中修改以下地方
服务端
1.# Allow NTP client access from local network.
allow 192.168.27.0/24(开启指定ntp客户端)
2.# Serve time even if not synchronized to a time source.
local stratum 10
3.systemctl restart chronyd
客户端
1.下载安装chrony服务
2.编写chrony配置文件
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).
server 192.168.27.120 iburst (ip是提供时间服务器的ip)
3.systemctl enable chronyd
systemctl start chronyd
检查是否同步成功
timedatectl status

4.chronyc****命令

查看 ntp services
结果查看
^* :代表的是时间同步正常,同步的时间源可用
^- :代表的是可接受的源
^? :时间同步的源是不可到达的
查看 ntp serveices 是否在线
查看 ntp 的详细信息

复制代码
[root@localhost ~]# chronyc activity -v
200 OK

[root@localhost ~]# chronyc tracking -v
相关推荐
JuiceFS12 小时前
从 MLPerf Storage v2.0 看 AI 训练中的存储性能与扩展能力
运维·后端
chen94518 小时前
mysql 3节点mgr集群部署
运维·后端
LH_R19 小时前
OneTerm开源堡垒机实战(三):功能扩展与效率提升
运维·后端·安全
dessler20 小时前
Hadoop HDFS-高可用集群部署
linux·运维·hdfs
少妇的美梦2 天前
logstash教程
运维
chen9452 天前
k8s集群部署vector日志采集器
运维
chen9452 天前
aws ec2部署harbor,使用s3存储
运维
christine-rr2 天前
linux常用命令(4)——压缩命令
linux·服务器·redis
東雪蓮☆2 天前
深入理解 LVS-DR 模式与 Keepalived 高可用集群
linux·运维·服务器·lvs
qq_264220892 天前
LVS负载均衡群集和LVS+Keepalived群集
运维·负载均衡·lvs