Rate This Document
Findability
Accuracy
Completeness
Readability

"Cluster NTP is out of sync" Displayed During the OceanBase Cluster Startup

Symptom

The following message is displayed when the OceanBase cluster is started:

[ERROR] Cluster NTP is out of sync.

Key Process and Cause Analysis

This error is reported because the time difference between hosts in the OceanBase cluster exceeds 100 ms. Use the NTP service to synchronize the time.

Conclusion and Solution

  1. Disable the firewall.
    systemctl stop firewalld
    systemctl disable firewalld
    systemctl status firewalld
  2. Install and configure the NTP service.
    1. Install NTP on all clusters and NTP client nodes.
      1
      yum -y install ntp ntpdate
      

    2. Back up the existing configuration on all clusters and NTP client nodes.
      1
      cd /etc && mv ntp.conf ntp.conf.bak
      
    3. Select a server as the NTP server node, and create and configure an NTP file on the server. In this example, the server whose IP address is 192.168.0.216 is the NTP server node.
      1. Create a file.
        1
        vi /etc/ntp.conf
        
      2. Press i to enter the insert mode and add the following content to the file as the NTP server:
        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
        

        In the preceding content, restrict 192.168.0.216 mask 255.255.255.0 indicates the network segment and mask of the NTP server.

      3. Press Esc, type :wq!, and press Enter to save the file and exit.
    4. Create NTP files on all other client nodes.
      1. Open the file.
        1
        vi /etc/ntp.conf
        
      2. Press i to enter the insert mode and add the following content to the file as the client node:
        1
        server 192.168.0.216
        
      3. Press Esc, type :wq!, and press Enter to save the file and exit.
  3. Start and synchronize the NTP service.
    1. On the NTP server node whose IP address is 192.168.0.216, start the NTP service and view the service status.
      1
      2
      3
      systemctl start ntpd
      systemctl enable ntpd
      systemctl status ntpd
      

    2. Forcibly synchronize the time of the NTP server node whose IP address is 192.168.0.216 to all other NTP client nodes.
      1
      ntpdate 192.168.0.216
      
    3. Write the hardware clock to all nodes except the 192.168.0.216 server node to prevent synchronization failure after the server is restarted.
      1
      hwclock -w
      
    4. Install and start the crontab tool on all nodes except the 192.168.0.216 server node.
      1
      2
      3
      4
      yum install -y crontabs
      chkconfig crond on
      systemctl start crond
      crontab -e
      

      Run the crontab -e command to open the crontab file of the current user for editing scheduled tasks.

    5. Add the following content to the crontab file to enable automatic time synchronization with the 192.168.0.216 server node every 10 minutes:
      1
      */10 * * * * /usr/sbin/ntpdate 192.168.0.216
      
    6. Press Esc, type :wq!, and press Enter to save the file and exit.