同步集群节点时钟
同步节点时钟以避免内部 custer 通信出现问题。
Redis 企业软件 |
---|
为避免内部集群通信问题影响数据完整性, 确保所有集群节点上的时钟都使用 Chrony 和/或 NTP 同步。
安装 Redis Enterprise Software 时, 安装脚本检查 Chrony 或 NTP 是否正在运行。 如果不是,则安装过程会请求配置计划的 Cron 作业的权限。 这应该确保 node 的 clock 始终同步。 如果您在安装过程中未确认配置此作业,则 您必须定期使用网络时间协议 (NTP) 以确保所有服务器时钟同步。
要同步服务器时钟,请运行适用于您的作系统的命令。
设置 NTP 同步
要设置 NTP 同步,请参阅以下部分,了解特定作系统的说明。
Ubuntu 18.04 和 Ubuntu 20.04
-
安装 Chrony,以替代 NTP:
sudo apt install chrony
-
Edit the Chrony configuration file:
sudo nano /etc/chrony/chrony.conf
-
Add
server pool.ntp.org
to the file, replacepool.ntp.org
with your own NTP server, then save. -
Restart the Chrony service:
sudo systemctl restart chrony
-
Check the Chrony service status:
sudo systemctl status chrony
For more details, refer to the official Ubuntu 20.04 documentation.
RHEL 7
-
Install Chrony, a replacement for NTP:
sudo yum install chrony
-
Edit the Chrony configuration file:
sudo nano /etc/chrony.conf
-
Add server pool.ntp.org
to the file, replace pool.ntp.org
with your own NTP server, then save.
-
Enable and start the Chrony service:
sudo systemctl enable chronyd && sudo systemctl start chronyd
-
Check the Chrony service status:
sudo systemctl status chronyd
For more details, refer to the official RHEL 7 documentation.
RHEL 8 and RHEL 9
-
Install Chrony, a replacement for NTP:
sudo dnf install chrony
-
Edit the Chrony configuration file:
sudo nano /etc/chrony.conf
-
Add server pool.ntp.org
to the file, replace pool.ntp.org
with your own NTP server, then save.
-
Enable and start the Chrony service:
sudo systemctl enable chronyd && sudo systemctl start chronyd
-
Check the Chrony service status:
sudo systemctl status chronyd
For more details, refer to the official RHEL 8 and 9 documentation.
Amazon Linux 2
-
Install Chrony, a replacement for NTP:
sudo yum install chrony
-
Edit the Chrony configuration file:
sudo nano /etc/chrony.conf
-
Add server pool.ntp.org
to the file, replace pool.ntp.org
with your own NTP server, then save.
-
Enable and start the Chrony service:
sudo systemctl enable chronyd && sudo systemctl start chronyd
-
Check the Chrony service status:
sudo systemctl status chronyd
For more details, refer to the official Amazon Linux 2 documentation.
If you are using Active-Active databases, you must use Network Time Service (ntpd)
to synchronize OS clocks consistently across clusters to handle conflict resolution according to the OS time.
On this page