Rate This Document
Findability
Accuracy
Completeness
Readability

Configuring NTP

Ceph automatically checks the time of storage nodes. If the time difference between nodes is large, an alarm is generated. Therefore, you need to configure the Network Time Protocol (NTP) to synchronize the time between nodes, thereby improving network management efficiency.

  1. Install and configure the NTP service.
    1. Install NTP on all server and client nodes.
      1
      yum -y install ntp ntpdate
      

    2. Back up the existing configuration on each server node and client node.
      1
      cd /etc && mv ntp.conf ntp.conf.bak
      
    3. Create an NTP file on ceph1, which serves as the NTP server.
      1
      vi /etc/ntp.conf
      
      Press i to enter the insert mode and add the following content:
      1
      2
      3
      4
      5
      restrict 127.0.0.1
      restrict ::1
      restrict 192.168.3.0 mask 255.255.255.0
      server 127.127.1.0
      fudge 127.127.1.0 stratum 8
      

      restrict 192.168.3.0 mask 255.255.255.0 is the network segment and subnet mask of ceph1.

    4. Create an NTP file on ceph2, ceph3, and all client nodes.
      1. Open the file.
        1
        vi /etc/ntp.conf
        
      2. Press i to enter the insert mode and add the following content:
        1
        server 192.168.3.166
        
      3. Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
  2. Start the NTP service.
    1. Start the NTP service on ceph1 and confirm that the service status is active.
      1
      2
      3
      systemctl start ntpd
      systemctl enable ntpd
      systemctl status ntpd
      

      Five minutes after the NTP process is started on ceph1, synchronize the time on other nodes. Otherwise, an error stating "no server suitable for synchronization found" is reported.

    2. Run the following command on all nodes except ceph1 to forcibly synchronize the NTP server (ceph1) time to all the other nodes:
      1
      ntpdate ceph1
      

      If the synchronization is successful on other nodes, the following information is displayed:

      15 Oct 14:43:39 ntpdate[32973]: adjust time server 192.168.3.166 offset -0.000034 sec
    3. Write the hardware clock to all nodes except ceph1 to prevent configuration failures after the restart.
      1
      hwclock -w
      
    4. Install and start the crontab tool on all nodes except ceph1.
      1
      2
      3
      4
      yum install -y crontabs
      chkconfig crond on
      systemctl start crond
      crontab -e
      
    5. Add the following information so that all nodes except ceph1 can automatically synchronize time with ceph1 every 10 minutes:
      1
      */10 * * * * /usr/sbin/ntpdate 192.168.3.166
      

      The IP address is the public network IP address of ceph1.