Setting up Chrony as Network Time Protocol server and client by using chronyd (Linux)

Note: Chrony is supported starting from Db2® 11.1.3.3 for RHEL 7.2 and later releases, and SLES 12 and later releases.

This topic outlines how to setup a Network Time Protocol (NTP) server using chronyd to ensure that all servers that the instance runs on have similar time settings.

Before you begin

By default, the NTP server is the primary CF. This setup is the best practice that helps with problem diagnosis and informal server monitoring. You can use the following steps in to change that default setting and assign another host to act as the NTP server.
The Db2 database manager checks whether Chrony is correctly set up on each member and verifies the presence of the Chrony daemon. The Db2 database manager also periodically compares time stamps between members to check that they differ by less than the value set by the MAX_TIME_DIFF database manager configuration parameter.
In a Db2 pureScale® environment, the value of MAX_TIME_DIFF represents the maximum number of minutes allowed between the system clocks of two members; the default is 1 minute. For each member, if Chrony is not correctly set up or the Chrony daemon is not present, or if time stamps between members differ by more than the value of MAX_TIME_DIFF, warnings are written to the db2diag log files.

About this task

Use the following steps to configure one of the hosts in the cluster or another host accessible by members as an NTP server by using chronyd. The system clock on this host is used as the clock that is synchronized. This host must remain online to continue synchronizing the clocks on the hosts.

Procedure

  1. Choose the master host that you set up as a NTP server.
  2. Edit /etc/chrony.conf and make sure it has the following lines:
    driftfile /var/lib/chrony/drift
    local stratum 8
    manual
    allow 192.168.165

    Address in allow field is the network or subnet address from which the clients are allowed to connect.

  3. On the clients: edit /etc/chrony.conf and make sure it has the following lines:
    server master iburst
    driftfile /var/lib/chrony/drift
    logdir /var/log/chrony
    log measurements statistics tracking
  4. Start and enable chronyd on each host:
    systemctl start chronyd 
    systemctl enable chronyd
    Note: Ensure only one of ntpd or chronyd is set up on all hosts in the cluster. Otherwise, it can lead to undesirable behavior. Especially if they are synced against a different time server.