启动OceanBase集群时提示:
[ERROR] Cluster NTP is out of sync.
由于OceanBase集群中主机时差超过100ms导致产生该报错,需要通过NTP服务来进行时间同步。
systemctl stop firewalld systemctl disable firewalld systemctl status firewalld
1
|
yum -y install ntp ntpdate |
1
|
cd /etc && mv ntp.conf ntp.conf.bak |
1
|
vi /etc/ntp.conf
|
1 2 3 4 5 |
restrict 127.0.0.1 restrict ::1 restrict 192.168.0.216 mask 255.255.255.0 server 127.127.1.0 fudge 127.127.1.0 stratum 8 |
其中,restrict 192.168.0.216 mask 255.255.255.0是NTP服务器的网段与掩码。
1
|
vi /etc/ntp.conf
|
1
|
server 192.168.0.216 |
1 2 3 |
systemctl start ntpd systemctl enable ntpd systemctl status ntpd |
1
|
ntpdate 192.168.0.216 |
1
|
hwclock -w
|
1 2 3 4 |
yum install -y crontabs chkconfig crond on systemctl start crond crontab -e |
在执行crontab -e命令后将打开当前用户的crontab文件,用于编辑定时任务。
1
|
*/10 * * * * /usr/sbin/ntpdate 192.168.0.216 |