Rate This Document
Findability
Accuracy
Completeness
Readability

Configuring NTP

Configure NTP on all nodes to synchronize the time between nodes in the cluster.

  1. Install chrony and set the time zone on all nodes. In this document, the Asian time zone is used as an example.
    yum install -y chrony 
    timedatectl set-timezone Asia/Shanghai
  2. Set the management node as the NTP server node.
    1. Open the /etc/chrony.conf file.
      vi /etc/chrony.conf
    2. Press i to enter the insert mode and add the following content:
      allow 192.168.1.0/24
      local stratum 10

      192.168.1.0/24 is the network segment used by each node in the cluster. Change it based on your actual requirements.

    3. Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
  3. Configure the worker node as the NTP client.
    1. Open the /etc/chrony.conf file.
      vi /etc/chrony.conf
    2. Press i to enter the insert mode and add # before pool pool.ntp.org iburst to comment out the content.

      The following figure shows the modification result.

      Add the following content:

      server MASTER_IP iburst

      MASTER_IP indicates the IP address of the management node.

    3. Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
  4. Start the NTP service.
    1. Start the NTP service on all nodes and check the service status.
      systemctl enable chronyd.service
      systemctl start chronyd.service
      systemctl status chronyd.service
    2. Restart NTP synchronization on all nodes.
      timedatectl set-ntp no
      timedatectl set-ntp yes
  5. Verify time synchronization.

    Wait for several seconds. Run the following command on the worker node to verify time synchronization:

    timedatectl status

    If the value of System clock synchronized is yes, the operation is successful.

    Run the date command on each node to check whether the time is the same.

    date