Setting up a Network Time Protocol server by using ntpd

This topic outlines how to setup a Network Time Protocol (NTP) server using ntpd to ensure that all servers that the instance runs on have similar time settings. By default, the NTP server is setup by the Db2® installer. During instance creation and update, the NTP is automatically setup on the primary CF. This setup is a best practice that will help with problem diagnosis and informal server monitoring.

Before you begin

In a Db2 pureScale® environment, to synchronize operations and facilitate time sensitive operations, the system clocks of all members must be synchronized.

For this reason, either ntpd or chronyd must be setup on all hosts in the cluster. On AIX, the Db2 installer installs and sets up the ntpd server and clients. On Linux, the ntpd server is used only if it was already set up prior to Db2 installation or if chronyd packages are not installed already. Regardless of ntpd or chronyd, the NTP server is the primary CF by default. You can use the steps in this topic to change the default setting and assign another host to act as the NTP server.

The Db2 database manager checks whether NTP is correctly set up on each member and verifies the presence of the NTP 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 NTP is not correctly set up or the NTP 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

If you do not have access to an NTP time server, use the following steps to configure one of the hosts in the cluster or another host accessible by members as an NTP server. The system clock on this host will be used as the clock that is synchronized. This host must remain online to continue synchronizing the clocks on the hosts.

Procedure

  1. Choose the host that you will setup as an NTP server.
  2. Setup the NTP daemon to synchronize to its own system clock. Edit /etc/ntp.conf and add the following lines:
    server 127.127.1.0 prefer # the logical IP address for the NTP server to sync 
    to its own system clock
    fudge 127.127.1.0
    driftfile /etc/ntp.drift
    tracefile /etc/ntp.trace
  3. Configure the NTP server to start at system restart.
    • On AIX® operating systems, run the chssys -s xntpd -a "-x" command, edit the /etc/rc.tcpip file and uncomment the following line:
      start /usr/sbin/xntpd "$src_running"
    • On Linux® operating systems, run the chkconfig ntp on command.
  4. Start the NTP server:
    • On AIX operating systems, run the startsrc -s xntpd command.
    • On Linux operating systems, run the service ntp start command.