确保主机时间与网络时间保持同步此操作示例仅供参考,实际情况请根据待容灾主机自身情况自行配置
Windows
示例操作系统:Windows2012 R2
使用Windows系统时间工具进行配置
点击桌面 Windows 图标 > 打开控制面板,选择日期和时间进行配置。

设置时间自动同步到Internet
在“日期和时间”选项卡中,点击“Internet Time”。 点击“更改设置”。


设置自动同步到本地时间同步服务器
如果你的主机在内网环境,需要将地址配置为您本地的时间同步服务器地址
:::tips
其中
:::

点击立即更新按钮,等待与Internet时间服务器同步

点击确认按钮即可
Linux
示例操作系统:CentOS Linux release 7.5
安装ntp
[root@node ~]# yum install -y ntp
启动ntp服务
[root@node ~]# systemctl start ntpd[root@node ~]# systemctl enable ntpdCreated symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.
查看ntp服务
[root@node ~]# systemctl status ntpd● ntpd.service - Network Time ServiceLoaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)Active: active (running) since Thu 2022-08-04 08:00:47 CST; 7h leftMain PID: 20746 (ntpd)Tasks: 1Memory: 768.0KCGroup: /system.slice/ntpd.service└─20746 /usr/sbin/ntpd -u ntp:ntp -gAug 04 08:00:47 node ntpd[20746]: Listen normally on 6 lo ::1 UDP 123Aug 04 08:00:47 node ntpd[20746]: Listen normally on 7 ens33 fe80::8a83:7297:7cb8:9934 UDP 123Aug 04 08:00:47 node ntpd[20746]: Listening on routing socket on fd #24 for interface updatesAug 04 08:00:47 node systemd[1]: Started Network Time Service.Aug 04 08:00:47 node ntpd[20746]: 0.0.0.0 c016 06 restartAug 04 08:00:47 node ntpd[20746]: 0.0.0.0 c012 02 freq_set kernel 0.000 PPMAug 04 08:00:47 node ntpd[20746]: 0.0.0.0 c011 01 freq_not_setAug 04 08:00:56 node ntpd[20746]: 0.0.0.0 c61c 0c clock_step -28798.353463 sAug 04 00:00:57 node ntpd[20746]: 0.0.0.0 c614 04 freq_modeAug 04 00:00:58 node ntpd[20746]: 0.0.0.0 c618 08 no_sys_peer
修改ntp.conf文件
请确保将 time.example.com 替换为你想要使用的实际NTP服务器地址。这个命令在修改后会直接保存文件,所以在执行前确保你对配置的修改没有问题。
# 将以server开头的行注释掉。# 在文件的末尾添加新的NTP服务器地址。[root@localhost ~]# sudo sed -i -e '/^server/ s/^server/#&/' -e '$ a server time.example.com iburst' /etc/ntp.conf
重启服务
[root@node ~]# systemctl restart ntpd
检查同步状态
[root@node ~]# ntpq -premote refid st t when poll reach delay offset jitter==============================================================================203.107.6.88 100.107.25.114 2 u 2 64 1 30.975 149.499 0.393
