搭建集群时,都会先设置时间同步,否则会出现多种问题。
方式一:
1.安装ntp软件
yum install -y ntp
2.更新时区
删除原有时区:sudo rm -f /etc/localtime
加载新时区:sudo ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
更新时区: ntpdate -u ntp.aliyun.com

3.设置开机自启动
systemctl start ntpd
systemctl enable ntpd

方式二:
systemctl start chronyd
systemctl enable chronyd
3台机器上分别执行这两个命令,然后在执行下方的查看命令
systemctl status chronyd.service