chrony 集群配置
时间: 2023-07-11 20:39:49 浏览: 53
Chrony 是一个 NTP 客户端和服务器,可以用于同步多个计算机的时钟。下面是一个简单的 Chrony 集群配置示例:
1. 安装 Chrony
在所有计算机上安装 Chrony:
```
sudo apt-get install chrony
```
2. 配置 Chrony 服务器
在某台计算机上作为 Chrony 服务器,编辑 `/etc/chrony/chrony.conf` 文件:
```
# 使用本地时钟
local stratum 10
# 允许其他计算机同步时钟
allow
# 允许所有计算机访问服务器
cmdallow 0/0
# 定义 NTP 服务器列表
server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
server 3.asia.pool.ntp.org
# 允许调整时钟
makestep 1 -1
```
3. 配置 Chrony 客户端
在其他计算机上作为 Chrony 客户端,编辑 `/etc/chrony/chrony.conf` 文件:
```
# 使用本地时钟
local stratum 10
# 允许其他计算机同步时钟
allow
# 允许所有计算机访问服务器
cmdallow 0/0
# 定义 Chrony 服务器列表
server <server_ip_address> iburst
# 允许调整时钟
makestep 1 -1
```
注意将 `<server_ip_address>` 替换为 Chrony 服务器的 IP 地址。
4. 启动 Chrony
在 Chrony 服务器上启动 Chrony 服务:
```
sudo systemctl start chrony
```
在其他计算机上重启 Chrony 服务:
```
sudo systemctl restart chrony
```
通过以上步骤,你可以配置一个简单的 Chrony 集群,用于同步多个计算机的时钟。