我要评分
获取效率
正确性
完整性
易理解

Configuring NTP

Configuring NTP on the Controller Node

  1. Install chrony.
    1
    yum -y install chrony
    
  2. Set a unified time zone for all nodes, for example, set the time zone to Asia.
    1
    timedatectl set-timezone Asia/Shanghai
    
  3. Configure the controller node as the internal NTP server and edit the /etc/chrony.conf file.
    1. Open the file.
      1
      vi /etc/chrony.conf
      
    2. Press i to enter the insert mode and add the following commands in the blank area:
      1
      2
      3
      4
      5
      6
      7
      # server 0.centos.pool.ntp.org iburst
      # server 1.centos.pool.ntp.org iburst
      # server 2.centos.pool.ntp.org iburst
      # server 3.centos.pool.ntp.org iburst
      server controller iburst
      allow 192.168.100.0/24
      local stratum 10
      

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  4. Enable the chrony service and configure it to start as the system boots.
    1
    2
    systemctl enable chronyd.service
    systemctl start chronyd.service
    
  5. Enable NTP time synchronization.
    1
    timedatectl set-ntp yes
    

Configuring NTP on the Compute Nodes (x86-compute and arm-compute)

  1. Install chrony.
    1
    yum -y install chrony
    
  2. Modify the /etc/chrony.conf file.
    1. Open the file.
      1
      vi /etc/chrony.conf
      
    2. Press i to enter the insert mode, add the following content to the file, and delete or comment out other contents related to server:
      1
      server controller iburst
      

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  3. Enable the chrony service and configure it to start as the system boots.
    1
    2
    systemctl enable chronyd.service
    systemctl restart chronyd.service
    
  4. Verify time synchronization.
    1
    chronyc sources
    

    controller is displayed as the clock source for the controller node and compute node (x86-compute and arm-compute).

    Run the date command to check whether the time is synchronized. If time synchronization fails, restart the NTP service.

    timedatectl set-ntp no
    timedatectl set-ntp yes